Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Sebastien Bechet 2016-06-03 16:15:12 +02:00
commit be5eb42a46
1896 changed files with 102783 additions and 42444 deletions

View File

@ -9,6 +9,7 @@ filter:
- dev/*
- doc/*
- test/*
- htdocs/includes/*
paths:
- htdocs/*
- scripts/*

View File

@ -50,7 +50,6 @@ env:
matrix:
fast_finish: true
allow_failures:
- php: '7.0'
- php: nightly
# FIXME
#- env: DB=postgresql
@ -79,7 +78,11 @@ before_install:
install:
- |
echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock
composer self-update
composer -n init
composer -n config vendor-dir htdocs/includes
echo
- |
@ -100,13 +103,14 @@ install:
- |
echo "Installing PHP CodeSniffer"
composer require squizlabs/php_codesniffer ^2
composer -n require squizlabs/php_codesniffer ^2
echo
- |
echo "Adding Composer binaries to the path"
echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo
before_script:
- |
@ -266,30 +270,32 @@ script:
- |
echo "Upgrading Dolibarr"
# Ensure we catch errors
set -e
set +e
cd htdocs/install
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log
php step5.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-3.log
php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log
php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log
php upgrade2.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-2.log
php step5.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-3.log
php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log
php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log
php upgrade2.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-2.log
php step5.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-3.log
php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log
php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log
php upgrade2.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-2.log
php step5.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-3.log
php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log
php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
php upgrade2.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-2.log
php step5.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-3.log
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API > $TRAVIS_BUILD_DIR/upgrade390400-2.log
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
cd -
set +e
echo
#cat $TRAVIS_BUILD_DIR/upgrade390400-2.log
#cat /tmp/dolibarr_install.log
- |
echo "Unit testing"
# Ensure we catch errors. Set this to +e if you want to go to this end to see log file.
# Ensure we catch errors. Set this to +e if you want to go to the end to see log file.
set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
set +e

View File

@ -14,7 +14,7 @@ Component Version License GPL Compatible
PHP libraries:
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
CKEditor 4.5.6 LGPL-2.1+ Yes Editor WYSIWYG
CKEditor 4.5.8 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
@ -27,9 +27,10 @@ PHPExcel 1.8.1 LGPL-2.1+ Yes
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.12 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
JS libraries:
jQuery 1.11.3 MIT License Yes JS library
@ -61,6 +62,8 @@ http://www.gnu.org/licenses/licenses.en.html
Copyright
---------
Copyright (C) 2016
Copyright (C) 2015
- Laurent Destailleur <eldy@users.sourceforge.net>
- Marcos García <marcosgdf@gmail.com>

238
ChangeLog
View File

@ -6,8 +6,8 @@ WARNING:
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection"
during migration.
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection" during
migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying
make a Dolibarr upgrade.
@ -15,8 +15,133 @@ make a Dolibarr upgrade.
***** ChangeLog for 4.0 compared to 3.9.* *****
For users:
NEW: Add reccuring invoice feature and automatic generation of invoices.
NEW: Add module "Loan" as stable.
NEW: Add module "Supplier commercial proposal" (price request) is set to stable status.
NEW: Experimental module Accountancy Expert
NEW: Experimental module Multicurency
NEW: Show into badge on tab head the number of dedicated contacts for all objects.
NEW: Add a checkbox to select/unselect all lines on page that support mass actions (like invoice list page)
NEW: Add a new method for margin calculation. Added margin on "cost price" to margin on WAP price and margin on "best supplier price".
NEW: Add an explanation message on shipment page to explain you can't make shipment if order is not validated
NEW: Add date_rum into table of thirdparty bank account.
NEW: The probability of lead/opportunity can be defined per lead.
NEW: Added Malta VAT into migration script
NEW: #4972 Translated Charges sociales (type 0) and Charges sociales (type 1) in reports page
NEW: Add Expense report into accountancy report
NEW: Add Expense report to approve into workboard
NEW: Selection of boxes is move on top of home page
NEW: Add filter on a keyword, status and nature into list of modules
NEW: Add hidden option BANK_DISABLE_CHECK_DEPOSIT to disable check deposit feature.
NEW: Add option MAIN_PUBLIC_NOTE_IN_ADDRESS
NEW: add html id/class to locate value in the DOM html
NEW: Add index on invoice status
NEW: Add constant MAIN_LOGTOHTML to 0 into other setup by default to save time when we need to make debug on hosted instance.
NEW: Add list of billed
NEW: Add minimum stock and desired stock into import/export profiles.
NEW: Add state into thirdparty export fields
NEW: Add more trackable events (create, submit and receive supplier order).
NEW: Add option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN
NEW: Add picto on module list to show warning and if module is an external module.
NEW: add product type filter on turnover report
NEW: Add state into list of fields available for personalized fields of thirdparties
NEW: Add statistics for interventions module
NEW: Add statistics on number of projets on home page
NEW: Add stats and late records into dashboard for supplier proposals.
NEW: Add the admin info on combo of type of contact
NEW: Add the event BILL_PAYED to list of supported events for module notification.
NEW: Add total weight and volume on PDF
NEW: Add hidden option to hide column qty ordered on shipments.
NEW: Add view of virtual stock into product list (when appropriate)
NEW: Add warning on tasks when they are late (add also the warning tolerance parameter)
NEW: Add weight/volume for one product into shipment export
NEW: Add width and height on product card
NEW: allow a document to be linked to project from another customer on config
NEW: allow project to be shared across entities (for multicompany module)
NEW: All variant of ckeditor config can be tested into the setup page of module.
NEW: Can change dynamically number of records visible into lists.
NEW: Can change type of extrafields for some combinations.
NEW: Can define number of first and last line into import wizard.
NEW: Can edit next execution date of a cron job.
NEW: Can edit value date of a vat payment after recording it.
NEW: Can filter modules on publisher
NEW: Can filter on employee status when building emailing from users
NEW: Can reopen an closed shipment
NEW: Can search on shipments into the quick search box
NEW: Can select dynamicaly number of lines to show on page on product, shipment, contact, orders, thirdparties
NEW: Can select fields to show on supplier orders list.
NEW: Can select fields to show on list also for list of customer orders, shipments and invoices.
NEW: Can select fields to show on proposal lists.
NEW: Can select language from combo list on page to overwrite a translation
NEW: Can select number of lines on page list for projects and tasks.
NEW: Can use ^ and $ (to say start with or end with like regex syntax) into search fields when search field is text. Bonus: ^$ can filter all lines with field not defined.
NEW: Clean and enhance code for cron engine
NEW: Can decrease stock on shipment closing/classifying (only if module lot is not enabled for the moment)
NEW: Disabled users are striked.
NEW: Enhance navigation of project module
NEW: fichinter lines ordered by rang AND DATE
NEW: hidden conf to use input file multiple from mail form
NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param).
NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy.
NEW: If error is reported during migration process, you can ignore it to avoid to be locked.
NEW: if nb total of lines provided in print barre_liste, display in title
NEW: If option to see non stable modules is on, add a filter into module list to filter on level (deprecated, experimental, development)
NEW: Include number of linked files into badge counter of "Linked files" tab.
NEW: Include sales representative into export of thirdparties
NEW: Indicator on workboard are red/green if late or not.
NEW: Into GED module, filename is truncated only if there is not enough space into table
NEW: Introduce a predefined job to run database backup
NEW: Introduce option MAIN_WEIGHT_DEFAULT_UNIT and MAIN_VOLUME_DEFAULT_UNIT to force output unit for weight and volume.
NEW: Introduce position of records into dictionnary of type of contacts
NEW: Link on user in leave context reach to leave tab.
NEW: List of user in agenda view per user show photo thumb
NEW: Margins module - Check/update buying price on invoice lines
NEW: Merge all admin tools (system and module admin tools) into same entry "Admin tools", so now things are clear: All features restricted to an admin user is inside "setup" (for setup) or "admin tools" (for action tools) instead of 3 different entries.
NEW: Merge all boxes "related objects" into one. This save a lot of room on most card and avoid often horizontal scoll.
NEW: Moved code that deals with bank categories to BankCateg. Created BankCateg::fetchAll function
NEW: Move Expense report menu from module to menu files
NEW: Move HRM dictionary from module to core dictionaries
NEW: Mutualize code to manage email substitution variables. Show available variables into page to edit email templates.
NEW: Mutualize code: Use one call of function "addThumbs", when possible, to generate thumbs files instead of several call of "vignette" function.
NEW: On translation admin page, admin can overwrite a translation value.
NEW: Option MAIN_LIST_FILTER_ON_DAY is supported on proposal list
NEW: Add reputation field for price supplier
NEW: Rest API token is no more reset at each call. We can reset it with param reset=1 on login call.
NEW: Selection of fields is available on member list.
NEW: Show a badge with number of withdraw requests done on the withdraw tab of invoice.
NEW: Add option to show detail per warehouse into reassort
NEW: Show total number of modules into the module list
NEW: Survey system has now a status like other objects. You can close or reopen a survey.
NEW: The note on time spent can be entered when using the view per day.
NEW: Use ellipsis truncation on too large left menu text
NEW: When a new field to show into lists is selected, the form is automatically submited and field added.
NEW: When creating a template invoice from a draft invoice, if there is link to contract on draft invoice, link is kept on template invoice.
NEW: When emailing is not sent completely, show progression.
For developers:
NEW: TimeZone can be supplied to mktime
NEW: hook in shipment card
NEW: Deprecated Societe::set_prospect_level, Societe::set_commnucation_level, Societe::set_OutstandingBill functions
NEW: A module can add, into its import profiles, a sql request to execute at end of import. This allow to update dernormalized data after import.
NEW: Add hook pdf_build_address
NEW: Add a parameter on graph function to show a generic graph when no data are available.
NEW: Add $object in parameter of pdf_build_address so we could include hook into the function.
NEW: Add a tool for developers to purge database with no loose of setup
NEW: Can disable a module by renaming dir of module into module.disabled (this save time for maintenance when working with FTP).
NEW: Created AccountLine::insert function and started using it for transaction creation
NEW: Created Account::__toString, Account::getFieldsToShow and Account::getAccountNumberOrder to refactor the way account number was shown
NEW: Created FormBank::getIBANLabel function to get the label of "IBAN" depending on bank account country
NEW: prepare for additional warehouse statuses
NEW: project sharing in select_projetcs_list function
NEW: Removed deprecated CommonObject::client property. Please use CommonObject::thirdparty instead
NEW: Removed unused FormOrder::selectSourcesCommande function
NEW: Renamed ActionComm::add function to ActionComm::create
NEW: Rename Form::select_date to Form::selectDate and Form::form_date to Form::formDate
NEW: Rename path for generiN
NEW: More phpunit tests. Include some REST API into automatic tests.
WARNING:
@ -24,12 +149,82 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect
Following changes may create regression for some external modules, but were necessary to make
Dolibarr better:
- Method FormBank::select_type_comptes_financiers() has been renamed into FormBank::selectTypeOfBankAccount()
- Method Form::form_date() has been renamed into Form::formDate()
- Method Form::select_date() has been renamed into Form::selectDate()
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
- Class Resource was renamed into DolResource to avoid conflict with a reserved PHP word.
- Method commonobject->add_thumb() has been renamed into commonobject->addThumbs().
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
- Property ->client that was deprecated 6 years ago, is replaced in all core code with ->thirdparty.
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
So if you included it into your module, change your code like this to be compatible with all version:
$res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
***** ChangeLog for 3.9.1 compared to 3.9.* *****
FIX: #3815 Call to undefined function local_by_date()
FIX: #4424 Missing email of user popup in supplier orders area
FIX: #4442 Missing translation in Banks menu
FIX: #4737 Bank transacion type selector translation is cropped
FIX: #4742 Able to delete a supplier invoice with a registered payment
FIX: #4743 UI glitch in project summary page
FIX: #4747 Missing UI background when registering a supplier invoice payment
FIX: #4748 Supplier invoice payment confirmation amount is not translated
FIX: #4766 VAT not shown in supplier invoice popup
FIX: #4784
FIX: #4809 Duplicate functions with different content
FIX: #4812
FIX: #4839
FIX: #4851 Project selector in supplier invoices shows the project label twice
FIX: #4870
FIX: #4874 SQL error when listing users
FIX: #4880
FIX: #4961
FIX: #4989
FIX: If oauth has never been activated two tables are missing and printing is not working
FIX: A not enabled field for list must not into fields to add
FIX: Bad color of message password changed
FIX: Bad error and style message when changing its own login
FIX: Bad function name call on delete
FIX: Bad include and param for project numbering module call
FIX: bad translation language loaded FIX: When changing thirdparty on event card, the showempty option of contact was lost. FIX: Bad placeholder shown on combo to select a thirdparty.
FIX: Bad vat definition when using POS module
FIX: Box disabled because bugged
FIX: Can not select a commercial on the creation of a third
FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12
FIX: correct display of minimum buying price
FIX: Creation of thumb image for size "small" was not done.
FIX: Damn, where was the project ref ?
FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code.
FIX: dont retrieve new buying price on margin display
FIX: Duplicate records into export
FIX: Each time we edit a line, we loose the unit price.
FIX: Email templates not compatible with Multicompany
FIX: Export must use a left join to not loose lines
FIX: fetchAllEMailTemplate
FIX: Filter/search on extrafields on lists
FIX: finished parameters not used
FIX: Generated thumbs must always use the png format so using thumbs can work.
FIX: Hook resprint be printed
FIX: image extension must be in lower case
FIX: Missing clean of criteria
FIX: Missing database escaping on supplier price insert/update
FIX: Missing function
FIX: Multiprice generator didn't recalculate prices if only the price_base_type property changes
FIX: Not removing code into vatrate.
FIX: Not showing sellprice properly on product list
FIX: Parsing of amount to pay vat
FIX: PHPCS
FIX: PMP is deprecated at warehouse level
FIX: real min buying price
FIX: Same term to create than other objects
FIX: Some records were lost into margin per product report
FIX: systematic rounding causes prices to be updated without reason
FIX: Template email must take care of positino column
FIX: VAT rate can be negative. Example spain selling to morroco.
FIX: When cloning an order the order result from clone must be now
FIX: When using option Price per level, when adding a predefined product, the vat for customer was not correctly set.
***** ChangeLog for 3.9.0 compared to 3.8.* *****
For users:
NEW: A new and more modern look for "eldy" theme.
@ -714,6 +909,23 @@ Dolibarr better:
- Function get_exdir require now 6 parameters. This is to prepare a future feature.
***** ChangeLog for 3.7.4 compared to 3.7.3 *****
FIX: #3694
FIX: #4239
FIX: #4291 Correctly filter external calendar GETPOSTs
FIX: #4341
FIX: #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property
FIX: #4440 Wrong price is filled by Product::fetch into multiprices arrays
FIX: add missing global def for ttc column
FIX: Contrat card don't consider user permissions to show active/unactive service button
FIX: CVE CVE-2015-8685
FIX: Email templates not compatible with Multicompany
Fix: for avoid division by 0
FIX: ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant
FIX: $outputlangs is not defined (dolibarr 3.7, 3.8, 3.9)
FIX: sql injection even when code is on several lines
FIX: The third dashboard don't consider user permissions
***** ChangeLog for 3.7.3 compared to 3.7.2 *****
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
FIX: #3890 Expected transactions bank account page, shows negative numbers
@ -1046,6 +1258,11 @@ Dolibarr better:
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
***** ChangeLog for 3.6.7 compared to 3.6.6 *****
FIX: #4291 Correctly filter external calendar GETPOSTs
FIX: CVE CVE-2015-8685
***** ChangeLog for 3.6.6 compared to 3.6.5 *****
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
FIX: #4081 Added missing translation
@ -1298,6 +1515,17 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
- Remove add_photo_web() that is not used anymore by core code.
***** ChangeLog for 3.5.8 compared to 3.5.7 *****
FIX: #4291 Correctly filter external calendar GETPOSTs
FIX: bad calculation for stock value
FIX: bad stock valo
FIX: change order date on clone (as everywhere else)
FIX: CVE CVE-2015-8685
FIX: The hours of date filter aren't correct
FIX: #3442 Remove useless syslog
FIX: #3448 Pass expected date format
FIX: #3471 3.5 Rounding issue when dispatching non-integer
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
Fix: Paypal link were broken due to SSL v3 closed.
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers

View File

@ -151,7 +151,7 @@ Administrator, user, developer and translator's documentations are available alo
## CONTRIBUTING
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/CONTRIBUTING.md)
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
## CREDITS

10
build/composer/README Normal file
View File

@ -0,0 +1,10 @@
To test upgrade of a lib with composer:
composer update --no-dev --no-autoloader --dry-run ccampbell/chromephp
To upgrade a lib with composer:
composer update --no-dev --no-autoloader ccampbell/chromephp

View File

@ -32,7 +32,7 @@ AppPublisherURL=http://www.nltechno.com
AppSupportURL=http://www.dolibarr.org
AppUpdatesURL=http://www.dolibarr.org
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
AppCopyright=Copyright (C) 2008-2015 Laurent Destailleur, NLTechno
AppCopyright=Copyright (C) 2008-2016 Laurent Destailleur, NLTechno
DefaultDirName=c:\dolibarr
DefaultGroupName=Dolibarr
;LicenseFile=COPYING
@ -80,7 +80,7 @@ Name: "desktopicon"; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:
Name: "{app}\logs"
Name: "{app}\tmp"
Name: "{app}\dolibarr_documents"
Name: "{app}\bin\apache\apache2.2.11\logs"
Name: "{app}\bin\apache\apache2.4.9\logs"
[Files]
; Stop/start
@ -101,10 +101,10 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi
; Put here path of Wampserver applications
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 or 5.1.36
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 or 5.1.36
Source: "C:\Program Files\Wamp\apps\phpmyadmin3.2.0.1\*.*"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
Source: "C:\Program Files\Wamp\bin\apache\apache2.2.11\*.*"; DestDir: "{app}\bin\apache\apache2.2.11"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
Source: "C:\Program Files\Wamp\bin\php\php5.3.0\*.*"; DestDir: "{app}\bin\php\php5.3.0"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
Source: "C:\Program Files\Wamp\bin\mysql\mysql5.6.17\*.*"; DestDir: "{app}\bin\mysql\mysql5.6.17"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
; Mysql data files (does not overwrite if exists)
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
; Dolibarr
@ -116,10 +116,10 @@ Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".
; Config files
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion;
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.2.11\conf"; Flags: ignoreversion;
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.3.0"; Flags: ignoreversion;
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion;
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.5.12"; Flags: ignoreversion;
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.6.17"; Flags: ignoreversion;
Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion;
Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion;
Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion;
@ -195,10 +195,10 @@ end;
procedure InitializeWizard();
begin
//version des applis, a modifier pour chaque version de WampServer 2
apacheVersion := '2.2.11';
phpVersion := '5.3.0' ;
mysqlVersion := '5.0.45';
phpmyadminVersion := '3.2.0.1';
apacheVersion := '2.4.9';
phpVersion := '5.5.12' ;
mysqlVersion := '5.6.17';
phpmyadminVersion := '4.1.14';
smtpServer := 'localhost';
apachePort := '80';
@ -329,10 +329,10 @@ begin
winPath := ExpandConstant('{win}');
pathWithSlashes := path;
StringChange (pathWithSlashes, '\','/');
datadirold := pathWithSlashes+'/bin/mysql/mysql5.0.45/data';
datadirold := pathWithSlashes+'/bin/mysql/mysql5.6.17/data';
datadirnew := pathWithSlashes+'/bin/mysql/data';
exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
exedirold := pathWithSlashes+'/bin/mysql/mysql5.6.17';
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.6.17';
// If we have a new database version, we should only copy old my.ini file into new directory
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
@ -663,6 +663,7 @@ begin
//installDir et version de php
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
StringChangeEx (srcContents, 'WAMPMYSQLVERSION', myport, True);
SaveStringToFile(destFile,srcContents, False);
end
@ -1002,7 +1003,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec
[UninstallDelete]
Type: files; Name: "{app}\*.*"
Type: files; Name: "{app}\bin\mysql\mysql5.0.45\*.*"
Type: files; Name: "{app}\bin\mysql\mysql5.6.17\*.*"
Type: filesandordirs; Name: "{app}\alias"
Type: filesandordirs; Name: "{app}\apps"
Type: filesandordirs; Name: "{app}\bin\apache"

View File

@ -69,7 +69,7 @@ port=WAMPMYSQLPORT
#Path to installation directory. All paths are usually resolved relative to this.
basedir=WAMPROOT/bin/mysql/mysql5.0.45
basedir=WAMPROOT/bin/mysql/mysqlWAMPMYSQLVERSION
#log file
log-error=WAMPROOT/logs/mysql.log
@ -226,7 +226,7 @@ port=WAMPMYSQLPORT
#Path to installation directory. All paths are usually resolved relative to this.
basedir=WAMPROOT/bin/mysql/mysql5.0.45
basedir=WAMPROOT/bin/mysql/mysql5.6.17
#log file
log-error=WAMPROOT/logs/mysql.log

View File

@ -379,7 +379,7 @@ if ($nboftargetok) {
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/)
if ($ret =~ /(already exists|existe déjà)/)
{
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
$QUESTIONOVERWRITETAG=<STDIN>;
@ -595,9 +595,12 @@ if ($nboftargetok) {
if ($target eq 'TGZ')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
if ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
print "Remove target $FILENAMETGZ.tgz...\n";
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
@ -624,8 +627,11 @@ if ($nboftargetok) {
if ($target eq 'XZ')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
if ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
print "Remove target $FILENAMEXZ.xz...\n";
unlink("$NEWDESTI/$FILENAMEXZ.xz");
@ -658,8 +664,11 @@ if ($nboftargetok) {
if ($target eq 'ZIP')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
if ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
print "Remove target $FILENAMEZIP.zip...\n";
unlink("$NEWDESTI/$FILENAMEZIP.zip");
@ -696,8 +705,11 @@ if ($nboftargetok) {
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 ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/'.$subdir);
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
}
if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; }
@ -779,8 +791,11 @@ if ($nboftargetok) {
if ($target eq 'DEB')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/package_debian-ubuntu');
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
if ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/package_debian-ubuntu');
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
}
$olddir=getcwd();
@ -979,8 +994,11 @@ if ($nboftargetok) {
if ($target eq 'APS')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/package_aps');
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }
if ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/package_aps');
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }
}
$newbuild = $BUILD;
$newbuild =~ s/(dev|alpha)/0/gi; # dev
@ -1062,8 +1080,11 @@ if ($nboftargetok) {
if ($target eq 'EXEDOLIWAMP')
{
$NEWDESTI=$DESTI;
mkdir($DESTI.'/package_windows');
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
if ($NEWPUBLISH =~ /stable/)
{
mkdir($DESTI.'/package_windows');
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
}
print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
@ -1195,8 +1216,8 @@ if ($nboftargetok) {
$command="rsync -s -e 'ssh' \"$file\" \"".$destFolder."\"";
print "$command\n";
my $ret=`$command 2>&1`;
print "$ret\n";
my $ret2=`$command 2>&1`;
print "$ret2\n";
}
}
}

View File

@ -9,7 +9,8 @@ beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog.
To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Commit all changes.
@ -31,7 +32,8 @@ complete release of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog.
To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- Update version number with x.y.z in htdocs/filefunc.inc.php
- Commit all changes.

View File

@ -12,15 +12,18 @@
"irc": "irc://chat.freenode.net/dolibarr",
"source": "https://github.com/Dolibarr/dolibarr"
},
"config": {
"vendor-dir": "htdocs/includes"
},
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"ccampbell/chromephp": "^4.1",
"ccampbell/chromephp": "4.1.0",
"ckeditor/ckeditor": "dev-full/stable",
"mike42/escpos-php": "dev-master",
"mike42/escpos-php": "1.2.1",
"mobiledetect/mobiledetectlib": "2.8.17",
"phpoffice/phpexcel": "1.8.1",
"restler/framework": "^3.0",
"restler/framework": "3.0.0-RC6",
"tecnickcom/tcpdf": "6.2.12"
},
"require-dev": {
@ -45,8 +48,5 @@
"ext-xml": "Excel support",
"firephp/firephp-core": "Logging to Firebug console support",
"raven/raven": "Sentry logging server support"
},
"config": {
"vendor-dir": "htdocs/includes"
}
}

1185
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,16 @@ Replace "& new" by "new"
CKEDITOR:
---------
* In ckeditor/ckeditor/contents.css
Replace:
margin: 20px;
With
margin: 5px;
NUSOAP:
-------
* In file nusoap.php, to avoid a warning,
@ -38,15 +48,16 @@ with:
}
TCPDF:
------
* Removed all fonts except
dejavusans* (used by greek, arab, persan, romanian, turkish),
freemono* (russian),
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
helvetica* (all other languages),
zapfdingbats.php (for special chars like form checkboxes)
* To avoid to have QRcode changed because generated with a random mask, replace
define('QR_FIND_FROM_RANDOM', 2);
with
define('QR_FIND_FROM_RANDOM', false);
* Removed useless directories (examples, tools)
* Fix
// initialize subsetchars
$subsetchars = array();
@ -54,19 +65,18 @@ into
// initialize subsetchars
$subsetchars = array_fill(0, 256, true);
* Made freemono the default monotype font because we removed courier
* Optionnaly, removed all fonts except
dejavusans* (used by greek, arab, persan, romanian, turkish),
freemono* (russian),
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
helvetica* (all other languages),
zapfdingbats.php (for special chars like form checkboxes)
* Optionnaly, made freemono the default monotype font because we removed courier
In htdocs/includes/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';
* Renamed getmypid into dol_getmypid().
To avoid to have QRcode changed because generated with a random mask, replace
define('QR_FIND_FROM_RANDOM', 2);
with
define('QR_FIND_FROM_RANDOM', false);
TCPDI:
@ -81,7 +91,6 @@ require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php')
JSGANTT:
--------
* Replace in function JSGantt.taskLink
@ -107,8 +116,15 @@ JQUERYFILETREE:
RESTLER:
--------
if ($className == 'Luracast\Restler\string') return;
if ($className == 'Luracast\Restler\mixed') return;
* Add 2 lines into function
private function alias($className, $currentClass)
{
...
to get
private function alias($className, $currentClass)
{
if ($className == 'Luracast\Restler\string') return;
if ($className == 'Luracast\Restler\mixed') return;
...

View File

@ -17,16 +17,16 @@ fi
# To detec
if [ "x$1" = "xlist" ]
then
find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
do
echo "Fix file $fic"
dos2unix $fic
dos2unix "$fic"
done;
fi

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -180,7 +180,7 @@ if (! $sourcecontent)
}
// Define output variables
$outfile='out.'.$classmin.'.class.php';
$outfile=$classmin.'.class.php';
$targetcontent=$sourcecontent;
// Substitute module name
@ -259,7 +259,7 @@ foreach($property as $key => $prop)
if ($addfield)
{
$varprop.="\t\t\$sql.= '".$prop['field'];
if ($i <= count($property)-$no_output_field) $varprop.=",";
if ($i < (count($property)-$no_output_field)) $varprop.=",";
$varprop.="';";
$varprop.="\n";
}
@ -455,9 +455,9 @@ else $error++;
//--------------------------------------------------------------------
$skeletonfiles=array(
$path.'skeleton_script.php' => 'out.'.$classmin.'_script.php',
$path.'skeleton_list.php' => 'out.'.$classmin.'_list.php',
$path.'skeleton_card.php' => 'out.'.$classmin.'_card.php'
$path.'skeleton_script.php' => $classmin.'_script.php',
$path.'skeleton_list.php' => $classmin.'_list.php',
$path.'skeleton_card.php' => $classmin.'_card.php'
);
foreach ($skeletonfiles as $skeletonfile => $outfile)
@ -670,5 +670,5 @@ foreach ($skeletonfiles as $skeletonfile => $outfile)
// -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
print "You can now rename generated files by removing the 'out.' prefix in their name and store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n";
print "You can now move generated files to store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n";
return $error;

View File

@ -50,25 +50,26 @@ class modMyModule extends DolibarrModules
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'mymodule';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
// Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other'
// It is used to group modules by family in module setup page
$this->family = "other";
// Module position in the family
$this->module_position = 500;
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily")));
//$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily")));
// 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));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Description of module MyModule";
$this->descriptionlong = "A very lon description. Can be a full HTML content";
$this->editor_name = 'Editor name';
$this->editor_url = 'http://www.dolibarr.org';
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = '1.0';
// 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.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'

View File

@ -288,7 +288,7 @@ if ($id && (empty($action) || $action == 'view' || $action == 'delete'))
dol_fiche_head();
if ($action == 'delete') {
$formconfirm = Form::formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
@ -322,7 +322,7 @@ if ($id && (empty($action) || $action == 'view' || $action == 'delete'))
// Example 2 : Adding links to objects
//$somethingshown=Form::showLinkedObjectBlock($object);
//$somethingshown=$form->showLinkedObjectBlock($object);
//$linktoelem = $form->showLinkToObjectBlock($object);
//if ($linktoelem) print '<br>'.$linktoelem;

View File

@ -71,7 +71,6 @@ class Skeleton_Class extends CommonObject
public function __construct(DoliDB $db)
{
$this->db = $db;
return 1;
}
/**
@ -249,7 +248,7 @@ class Skeleton_Class extends CommonObject
$line->prop1 = $obj->field1;
$line->prop2 = $obj->field2;
$this->lines[] = $line;
$this->lines[$line->id] = $line;
//...
}
$this->db->free($resql);

View File

@ -43,7 +43,9 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
if (! $res) die("Include of main fails");
// Change this following line to use the correct relative path from htdocs
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/mymodule/class/skeleton_class.class.php');
// Load traductions files requiredby by page
@ -124,6 +126,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
* Put here all code to do according to value of "action" parameter
********************************************************************/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -142,6 +147,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
// Action to delete
if ($action == 'confirm_delete')
{
@ -217,7 +235,7 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
@ -248,7 +266,8 @@ if ($resql)
$num = $db->num_rows($resql);
$params='';
if ($search_field1 != '') $params.= '&amp;search_field1='.urlencode($search_field1);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_field1 != '') $params.= '&amp;search_field1='.urlencode($search_field1);
if ($search_field2 != '') $params.= '&amp;search_field2='.urlencode($search_field2);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
@ -262,10 +281,11 @@ if ($resql)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -291,14 +311,14 @@ if ($resql)
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=Form::multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
// Fields title
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -315,8 +335,8 @@ if ($resql)
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>'."\n";
@ -335,12 +355,15 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'select')))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
print '<input class="flat" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
@ -365,18 +388,20 @@ if ($resql)
{
// Status
print '<td class="liste_titre" align="center">';
print Form::selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
print '</td>';
}*/
// Action column
print '<td class="liste_titre" align="right">';
$searchpitco=Form::showFilterAndCheckAddButtons();
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print '</tr>'."\n";
$i = 0;
$i=0;
$var=true;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
@ -384,8 +409,16 @@ if ($resql)
{
// You can use here results
print '<tr>';
if (! empty($arrayfields['t.field1']['checked'])) print '<td>'.$obj->field1.'</td>';
if (! empty($arrayfields['t.field2']['checked'])) print '<td>'.$obj->field2.'</td>';
if (! empty($arrayfields['t.field1']['checked']))
{
print '<td>'.$obj->field1.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.field2']['checked']))
{
print '<td>'.$obj->field2.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -400,6 +433,7 @@ if ($resql)
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
}
@ -413,6 +447,7 @@ if ($resql)
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['t.tms']['checked']))
@ -420,6 +455,7 @@ if ($resql)
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
/*
@ -428,9 +464,12 @@ if ($resql)
$userstatic->statut=$obj->statut;
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
}*/
// Action column
print '<td></td>';
print '</tr>';
if (! $i) $totalarray['nbfield']++;
print '</tr>';
}
$i++;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 96 KiB

2
htdocs/.gitignore vendored
View File

@ -20,5 +20,5 @@
/allscreens*
/ecommerce/
/cabinetmed*
/conf/conf.php
/webmail*
/conf/conf.php

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,9 +44,13 @@ $search_pcgtype = GETPOST("search_pcgtype");
$search_pcgsubtype = GETPOST("search_pcgsubtype");
// Security check
if (! $user->admin)
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->chartofaccount)
accessforbidden();
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'sortorder');
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -53,7 +58,7 @@ $page = GETPOST("page", 'int');
if ($page == - 1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield)
@ -61,13 +66,31 @@ if (! $sortfield)
if (! $sortorder)
$sortorder = "ASC";
if ($action == 'delete') {
$formconfirm = Form::formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
$accounting = new AccountingAccount($db);
/*
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_desactivate($id);
@ -87,21 +110,18 @@ if ($action == 'disable') {
}
}
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
}
/*
* View
*
*/
llxHeader('', $langs->trans("ListAccounts"));
if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
@ -126,8 +146,16 @@ if (strlen(trim($search_pcgtype))) {
if (strlen(trim($search_pcgsubtype))) {
$sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
@ -136,7 +164,15 @@ $result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
$params='';
if ($search_account != "") $params.= '&amp;search_account='.urlencode($search_account);
if ($search_label != "") $params.= '&amp;search_label='.urlencode($search_label);
if ($search_accountparent != "") $params.= '&amp;search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype != "") $params.= '&amp;search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype != "") $params.= '&amp;search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
$i = 0;
@ -145,27 +181,28 @@ if ($result) {
print '<br/>';
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</a>';
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
print '<br/><br/>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $params, "", 'width="60" align="center"', $sortfield, $sortorder);
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_accountparent" value="' . $search_accountparent . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="' . $search_accountparent . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
@ -190,7 +227,7 @@ if ($result) {
print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
print '<td>' . $obj->label . '</td>';
if ($obj->account_parent)
if (! empty($obj->account_parent))
{
$accountparent->id = $obj->rowid2;
$accountparent->label = $obj->label2;

View File

@ -1,6 +1,6 @@
<?PHP
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -18,9 +18,9 @@
*/
/**
* \file htdocs/accountancy/admin/card.php
* \ingroup Accounting Expert
* \brief Card accounting account
* \file htdocs/accountancy/admin/card.php
* \ingroup Advanced accountancy
* \brief Card of accounting account
*/
require '../../main.inc.php';
@ -28,6 +28,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$error = 0;
@ -45,7 +46,7 @@ $cancel = GETPOST('cancel');
if (! $user->admin)
accessforbidden();
$accounting = new AccountingAccount($db);
$object = new AccountingAccount($db);
// Action
if ($action == 'add') {
@ -55,48 +56,64 @@ if ($action == 'add') {
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$accounting->active = 1;
$res = $accounting->create($user);
if ($res == 0) {
// Clean code
$account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right
if (GETPOST('account_category') <= 0) {
$account_parent = '';
} else {
if ($res == - 3) {
$error = 1;
$action = "create";
}
if ($res == - 4) {
$error = 2;
$action = "create";
}
$account_parent = GETPOST('account_category','int');
}
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type');
$object->pcg_subtype = GETPOST('pcg_subtype');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category');
$object->label = GETPOST('label', 'alpha');
$object->active = 1;
$res = $object->create($user);
if ($res == - 3) {
$error = 1;
$action = "create";
}
if ($res == - 4) {
$error = 2;
$action = "create";
}
}
Header("Location: account.php");
header("Location: account.php");
exit;
} else if ($action == 'edit') {
if (! GETPOST('cancel', 'alpha')) {
$result = $accounting->fetch($id);
$result = $object->fetch($id);
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
// Clean code
$account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right
if (GETPOST('account_category') <= 0) {
$account_parent = '';
} else {
$account_parent = GETPOST('account_category','int');
}
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type');
$object->pcg_subtype = GETPOST('pcg_subtype');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category');
$object->label = GETPOST('label', 'alpha');
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$result = $accounting->update($user);
$result = $object->update($user);
if ($result > 0) {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
@ -109,18 +126,19 @@ if ($action == 'add') {
exit();
}
} else if ($action == 'delete') {
$result = $accounting->fetch($id);
$result = $object->fetch($id);
if (! empty($accounting->id)) {
$result = $accounting->delete($user);
if (! empty($object->id)) {
$result = $object->delete($user);
if ($result > 0) {
Header("Location: account.php");
header("Location: account.php");
exit;
}
}
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -131,7 +149,9 @@ llxheader('', $langs->trans('AccountAccounting'));
$form = new Form($db);
$htmlacc = new FormVentilation($db);
$formaccounting = new FormAccounting($db);
// Create mode
if ($action == 'create') {
print load_fiche_titre($langs->trans('NewAccount'));
@ -142,22 +162,37 @@ if ($action == 'create') {
dol_fiche_head();
print '<table class="border" width="100%">';
// Account number
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
// Label
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
// Account parent
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td>';
print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
print '</td></tr>';
// Category
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>';
// Chart of accounts type
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>';
print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcg_type');
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
print '</td></tr>';
// Chart of acounts subtype
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td>';
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
print '</td></tr>';
print '</table>';
@ -172,20 +207,16 @@ if ($action == 'create') {
print '</form>';
} else if ($id) {
$rowid = $id;
$account = $accounting->fetch($rowid);
$result = $object->fetch($id);
if ($account > 0) {
if ($result > 0) {
dol_htmloutput_mesg($mesg);
$head = accounting_prepare_head($accounting);
$head = accounting_prepare_head($object);
if ($action == 'update') {
$soc = new Societe($db);
if ($object->socid) {
$soc->fetch($object->socid);
}
// Edit mode
if ($action == 'update')
{
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
@ -195,21 +226,36 @@ if ($action == 'create') {
print '<table class="border" width="100%">';
// Account number
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
// Label
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
// Account parent
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td>';
print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>';
// Chart of accounts type
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>';
print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcg_type');
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
print '</td></tr>';
// Chart of accounts subtype
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td>';
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
print '</td></tr>';
print '</table>';
@ -224,6 +270,8 @@ if ($action == 'create') {
print '</form>';
} else {
// View mode
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
@ -232,29 +280,37 @@ if ($action == 'create') {
// Account number
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
print '<td>' . $accounting->account_number . '</td>';
print '<td>' . $object->account_number . '</td>';
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
// Label
print '<tr><td>' . $langs->trans("Label") . '</td>';
print '<td colspan="2">' . $accounting->label . '</td></tr>';
print '<td colspan="2">' . $object->label . '</td></tr>';
// Account parent
$accp = new AccountingAccount($db);
if (! empty($accounting->account_parent)) {
$accp->fetch($accounting->account_parent, '');
if (! empty($object->account_parent)) {
$accp->fetch($object->account_parent, '');
}
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
print '<td colspan="2">' . $accp->account_number . ' - ' . $accp->label . '</td></tr>';
// Category
print "<tr><td>".$langs->trans("AccountingCategory")."</td><td colspan='2'>".$object->account_category_label."</td>";
// Chart of accounts type
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
print '<td colspan="2">' . $accounting->pcg_type . '</td></tr>';
print '<td colspan="2">' . $object->pcg_type . '</td></tr>';
// Chart of accounts subtype
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>';
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
// Active
print '<tr><td>' . $langs->trans("Activated") . '</td>';
print '<td colspan="2">';
if (empty($accounting->active)) {
if (empty($object->active)) {
print img_picto($langs->trans("Disabled"), 'switch_off');
} else {
print img_picto($langs->trans("Activated"), 'switch_on');
@ -267,7 +323,7 @@ if ($action == 'create') {
dol_fiche_end();
/*
* Barre d'actions
* Actions buttons
*/
print '<div class="tabsAction">';

View File

@ -0,0 +1,157 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/admin/categories.php
* \ingroup Advanced accountancy
* \brief Page to assign mass categories to accounts
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$error = 0;
// Langs
$langs->load("bills");
$langs->load("accountancy");
$mesg = '';
$action = GETPOST('action');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$cpt_id = GETPOST('cptid');
if($cat_id == 0){
$cat_id = null;
}
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
// Security check
if (! $user->admin)
accessforbidden();
$AccCat = new AccountancyCategory($db);
// si ajout de comptes
if(!empty($selectcpt)){
$cpts = array();
$i = 0;
foreach ($selectcpt as $selectedOption){
$cpts[$i] = "'".$selectedOption."'";
$i++;
}
if($AccCat->updateAccAcc($cat_id, $cpts)){
setEventMessages($langs->trans('Saved'), null, 'mesgs');
}else{
setEventMessages($langs->trans('errors'), null, 'errors');
}
}
if ($action == 'delete') {
if($cpt_id){
if($AccCat->deleteCptCat($cpt_id)){
setEventMessages($langs->trans('Deleted'), null, 'mesgs');
}else{
setEventMessages($langs->trans('errors'), null, 'errors');
}
}
}
/*
* View
*/
llxheader('', $langs->trans('AccountAccounting'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
print load_fiche_titre($langs->trans('Categories'));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="display">';
dol_fiche_head();
print '<table class="border" width="100%">';
// Category
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
print '<td>';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1);
print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">';
print '</td></tr>';
if(!empty($cat_id)){
$obj = $AccCat->getCptBK($cat_id);
print '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>';
print '<td>';
if(!empty($obj)){
print '<select size="'.count($obj).'" name="cpt_bk[]" multiple>';
foreach ( $obj as $cpt ) {
print '<option value="'.length_accountg($cpt->numero_compte).'">' . length_accountg($cpt->numero_compte) . ' ('.$cpt->label_compte.' '.$cpt->doc_ref.')</option>';
}
print '</select> - <input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("add") . '"> ';
}
print '</td></tr>';
}
print '</table>';
dol_fiche_end();
print '</form>';
if ($action == 'display' || $action == 'delete') {
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Numerocompte").'</th><th class="liste_titre">'.$langs->trans("Description").'</th><th class="liste_titre" width="60" align="center">Action</th></tr>';
if(!empty($cat_id)){
$obj = $AccCat->display($cat_id);
$j=1;
if(!empty($obj)){
foreach ( $obj as $cpt ) {
$var = ! $var;
print "<tr $bc[$var]>";
print '<td>' . length_accountg($cpt->account_number) . '</td>';
print '<td>' . $cpt->label . '</td>';
print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j);
print '<td><input class="button" type="button" id="action-delete'.$j.'" value="' . $langs->trans("Delete") . '"></td>';
print "</tr>\n";
$j++;
}
}
}
print "</table>";
}
llxFooter();
$db->close();

View File

@ -21,9 +21,9 @@
*/
/**
* \file htdocs/accountancy/admin/export.php
* \ingroup Accounting Expert
* \brief Setup page to configure accounting expert module
* \file htdocs/accountancy/admin/export.php
* \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module
*/
require '../../main.inc.php';
@ -50,12 +50,14 @@ $main_option = array (
$model_option = array (
'ACCOUNTING_EXPORT_SEPARATORCSV',
'ACCOUNTING_EXPORT_DATE',
'ACCOUNTING_EXPORT_DATE'
/*
'ACCOUNTING_EXPORT_PIECE',
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
'ACCOUNTING_EXPORT_LABEL',
'ACCOUNTING_EXPORT_AMOUNT',
'ACCOUNTING_EXPORT_DEVISE'
'ACCOUNTING_EXPORT_DEVISE'
*/
);
/*
@ -149,7 +151,7 @@ if (! $conf->use_javascript_ajax) {
'csv' => $langs->trans("csv"),
'txt' => $langs->trans("txt")
);
print Form::selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
print '</td>';
}
@ -197,7 +199,7 @@ if (! $conf->use_javascript_ajax) {
} else {
print '<td>';
$listmodelcsv = AccountancyExport::getType();
print Form::selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
print '</td>';
}

View File

@ -27,6 +27,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$action = GETPOST('action');
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.rowid"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
$langs->load("admin");
$langs->load("compta");
@ -54,6 +66,8 @@ $object = new Fiscalyear($db);
* Actions
*/
/*
* View
*/
@ -66,11 +80,20 @@ $title = $langs->trans('FiscalYears');
llxHeader('', $title, LOG_ERR);
print load_fiche_titre($langs->trans('FiscalYears'));
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear as f";
$sql .= " WHERE f.entity = " . $conf->entity;
$sql.=$db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql);
if ($result) {
@ -78,6 +101,9 @@ if ($result) {
$num = $db->num_rows($result);
$i = 0;
$title = $langs->trans('FiscalYears');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit, 1);
// Load attribute_label
print '<table class="noborder" width="100%">';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -53,6 +53,7 @@ $object = new Fiscalyear($db);
$date_start = dol_mktime(0, 0, 0, GETPOST('fiscalyearmonth', 'int'), GETPOST('fiscalyearday', 'int'), GETPOST('fiscalyearyear', 'int'));
$date_end = dol_mktime(0, 0, 0, GETPOST('fiscalyearendmonth', 'int'), GETPOST('fiscalyearendday', 'int'), GETPOST('fiscalyearendyear', 'int'));
/*
* Actions
*/
@ -143,10 +144,8 @@ llxHeader();
$form = new Form($db);
/*
* Action create
*/
if ($action == 'create') {
if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewFiscalYear"));
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
@ -162,19 +161,19 @@ if ($action == 'create') {
// Date start
print '<tr><td class="fieldrequired">' . $langs->trans("DateStart") . '</td><td>';
print Form::selectDate(($date_start ? $date_start : ''), 'fiscalyear');
print $form->select_date(($date_start ? $date_start : ''), 'fiscalyear');
print '</td></tr>';
// Date end
print '<tr><td class="fieldrequired">' . $langs->trans("DateEnd") . '</td><td>';
print Form::selectDate(($date_end ? $date_end : - 1), 'fiscalyearend');
print $form->select_date(($date_end ? $date_end : - 1), 'fiscalyearend');
print '</td></tr>';
// Statut
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Statut") . '</td>';
print '<td class="fieldrequired">' . $langs->trans("Status") . '</td>';
print '<td class="valeur">';
print Form::selectarray('statut', $statut2label, GETPOST('statut'));
print $form->selectarray('statut', $statut2label, GETPOST('statut'));
print '</td></tr>';
print '</table>';
@ -205,8 +204,8 @@ if ($action == 'create') {
// Ref
print "<tr>";
print '<td width="20%">' . $langs->trans("Ref") . '</td><td>';
print $object->rowid;
print '<td class="titlefield">' . $langs->trans("Ref") . '</td><td>';
print $object->ref;
print '</td></tr>';
// Label
@ -216,17 +215,17 @@ if ($action == 'create') {
// Date start
print '<tr><td class="fieldrequired">' . $langs->trans("DateStart") . '</td><td>';
print Form::selectDate($object->date_start ? $object->date_start : - 1, 'fiscalyear');
print $form->select_date($object->date_start ? $object->date_start : - 1, 'fiscalyear');
print '</td></tr>';
// Date end
print '<tr><td class="fieldrequired">' . $langs->trans("DateEnd") . '</td><td>';
print Form::selectDate($object->date_end ? $object->date_end : - 1, 'fiscalyearend');
print $form->select_date($object->date_end ? $object->date_end : - 1, 'fiscalyearend');
print '</td></tr>';
// Statut
print '<tr><td>' . $langs->trans("Statut") . '</td><td>';
print Form::selectarray('statut', $statut2label, $object->statut);
print $form->selectarray('statut', $statut2label, $object->statut);
print '</td></tr>';
print '</table>';
@ -245,41 +244,41 @@ if ($action == 'create') {
* Confirm delete
*/
if ($action == 'delete') {
print Form::formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete");
print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete");
}
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
$linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td width="50%">';
print $object->rowid;
print $object->ref;
print '</td><td width="25%">';
print $linkback;
print '</td></tr>';
// Label
print '<tr><td valign="top">';
print Form::editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print '</td><td colspan="2">';
print Form::editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print "</td></tr>";
// Date start
print '<tr><td>';
print Form::editfieldkey("Date", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td><td colspan="2">';
print Form::editfieldval("Date", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td></tr>';
// Date end
print '<tr><td>';
print Form::editfieldkey("Date", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td><td colspan="2">';
print Form::editfieldval("Date", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td></tr>';
// Statut

View File

@ -19,9 +19,9 @@
*/
/**
* \file htdocs/accountancy/admin/importaccounts.php
* \ingroup Accounting Expert
* \brief Page import accounting account
* \file htdocs/accountancy/admin/importaccounts.php
* \ingroup Advanced accountancy
* \brief Page import accounting account
*/
require '../../main.inc.php';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -23,9 +23,9 @@
*/
/**
* \file htdocs/accountancy/admin/index.php
* \ingroup Accounting Expert
* \brief Setup page to configure accounting expert module
* \file htdocs/accountancy/admin/index.php
* \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module
*/
require '../../main.inc.php';
@ -38,6 +38,7 @@ $langs->load("compta");
$langs->load("bills");
$langs->load("admin");
$langs->load("accountancy");
$langs->load("salaries");
// Security check
if (! $user->admin)
@ -45,7 +46,7 @@ if (! $user->admin)
$action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_*
// Parameters ACCOUNTING_* and others
$list = array (
'ACCOUNTING_LIMIT_LIST_VENTILATION',
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
@ -55,16 +56,19 @@ $list = array (
);
$list_account = array (
'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER',
'ACCOUNTING_ACCOUNT_CUSTOMER',
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_VAT_PAY_ACCOUNT',
'ACCOUNTING_ACCOUNT_SUSPENSE',
'ACCOUNTING_ACCOUNT_TRANSFER_CASH'
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
'DONATION_ACCOUNTINGACCOUNT'
);
/*
@ -215,10 +219,9 @@ print "<td>" . $langs->trans("Selectchartofaccounts") . "</td>";
print "<td>";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
$sql = "SELECT rowid, pcg_version, fk_pays, label, active";
$sql = "SELECT rowid, pcg_version, label, active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " WHERE active = 1";
$sql .= " AND fk_pays = " . $mysoc->country_id;
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
$resql = $db->query($sql);
@ -234,7 +237,7 @@ if ($resql) {
print '<option value="' . $row[0] . '"';
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected' : '';
print '>' . $row[1] . ' - ' . $row[3] . '</option>';
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
$i ++;
}

View File

@ -1,31 +1,32 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/accountancy/admin/journal.php
* \ingroup Accounting Expert
* \brief Setup page to configure accounting expert module
*/
* \file htdocs/accountancy/admin/journal.php
* \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module
*/
require '../../main.inc.php';
// Class
@ -48,24 +49,44 @@ $list = array (
'ACCOUNTING_PURCHASE_JOURNAL',
'ACCOUNTING_SOCIAL_JOURNAL',
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
);
/*
* Actions
*/
*/
if ($action == 'update') {
$error = 0;
foreach ( $list as $constname ) {
// Save vars
foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
// Save bank account journals
$arrayofbankaccount = GETPOST('bank_account', 'array');
foreach($arrayofbankaccount as $key => $code)
{
$bankaccount = new Account($db);
$res = $bankaccount->fetch($key);
if ($res > 0)
{
$bankaccount->accountancy_journal = $code;
$bankaccount->update($user);
}
else
{
$error++;
break;
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -75,7 +96,7 @@ if ($action == 'update') {
/*
* View
*/
*/
llxHeader();
@ -99,13 +120,13 @@ print "</tr>\n";
foreach ( $list as $key ) {
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
// Param
$label = $langs->trans($key);
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
@ -118,11 +139,11 @@ print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('JournalFinancial') . '</td>';
print '<td colspan="3">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>';
print "</tr>\n";
// Bank account
$sql = "SELECT rowid, label, accountancy_journal";
$sql = "SELECT rowid, label, number, accountancy_journal";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
$sql .= " WHERE entity = " . $conf->entity;
$sql .= " AND clos = 0";
@ -132,29 +153,41 @@ $resql = $db->query($sql);
if ($resql) {
$numr = $db->num_rows($resql);
$i = 0;
if ($numr > 0)
while ( $i < $numr ) {
$objp = $db->fetch_object($resql);
$bankaccountstatic=new Account($db);
while ( $i < $numr ) {
$objp = $db->fetch_object($resql);
$var = ! $var;
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
$bankaccountstatic->id = $objp->rowid;
$bankaccountstatic->label = $objp->label;
$bankaccountstatic->number = $objp->number;
$bankaccountstatic->accountancy_journal = $objp->accountancy_journal;
// Param
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal") . ' - ' . $objp->label . '</label></td>';
print '<tr ' . $bc[$var] . ' class="value">';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $objp->rowid . '" name="' . $objp->label . '" value="' . $objp->accountancy_journal . '" disabled>';
print '</td></tr>';
// Param
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal");
print ' - '.$bankaccountstatic->getNomUrl(1);
print '</label></td>';
$i ++;
}
} else
// Value
print '<td>';
print '<input type="text" size="20" id="' . $objp->rowid . '" name="bank_account['.$objp->rowid.']" value="' . $objp->accountancy_journal . '">';
print '</td></tr>';
$i ++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
$db->free($resql);
}
print "</table>\n";

View File

@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief To define accounting account on product / service
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Advanced accountancy
* \brief To define accounting account on product / service
*/
require '../../main.inc.php';
@ -184,7 +184,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
* View
*/
llxHeader('', $langs->trans("Accounts"));
llxHeader('', $langs->trans("InitAccountancy"));
print '<script type="text/javascript">
$(function () {
@ -241,7 +241,7 @@ if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print_barre_liste($langs->trans("ModulesSystemTools"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br>';
print $langs->trans("InitAccountancyDesc") . '<br>';
@ -263,9 +263,9 @@ if ($result) {
print "</table>\n";
print '<br /><div align="right"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
print "<br>\n";
print "<br><br>\n";
if (! empty($msg)) {
print $msg;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,9 +19,9 @@
*/
/**
* \file htdocs/accountancy/bookkeeping/balance.php
* \ingroup Accounting Expert
* \brief Balance of book keeping
* \file htdocs/accountancy/bookkeeping/balance.php
* \ingroup Advanced accountancy
* \brief Balance of book keeping
*/
require '../../main.inc.php';
@ -79,7 +79,7 @@ if (empty($search_date_start)) {
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
$sortfield = "t.rowid";
$sortfield = "t.numero_compte";
$options = '';
$filter = array ();
@ -100,9 +100,11 @@ if (! empty($search_accountancy_code_end)) {
$options .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
}
/*
* Action
*/
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
@ -137,7 +139,6 @@ else {
/*
* List
*/
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
@ -151,24 +152,36 @@ else {
setEventMessages($object->error, $object->errors, 'errors');
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print Form::selectDate($search_date_start, 'date_start', 0, 0, 1);
print $langs->trans('DateEnd') . ': ';
print Form::selectDate($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
$moreforfilter='';
print '<table class="noborder" width="100%">';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('DateStart') . ': ';
$moreforfilter.=$form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
$moreforfilter.=$langs->trans('DateEnd') . ': ';
$moreforfilter.=$form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
$moreforfilter.='</div>';
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
@ -176,11 +189,11 @@ else {
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td>';
print '<td colspan="2">';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print '<br>';
print $langs->trans('To');
print $langs->trans('to');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
@ -203,23 +216,28 @@ else {
foreach ( $object->lines as $line ) {
$var = ! $var;
$link = '';
$total_debit += $line->debit;
$total_credit += $line->credit;
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
if(empty($description)){
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
}
print "<tr $bc[$var]>";
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="right">' . price($line->credit - $line->debit) . '</td>';
print '<td align="center">';
print '<td>' . $description . '</td>';
print '<td align="right">' . number_format($line->debit, 2, ',', ' ') . '</td>';
print '<td align="right">' . number_format($line->credit, 2, ',', ' ') . '</td>';
print '<td align="right">' . number_format($line->credit - $line->debit, 2, ',', ' ') . '</td>';
print '<td align="center">' . $link;
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td></td>';
print '<td></td>';
print '<td align="right">';
print price($total_debit);
print '</td>';

View File

@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
* \ingroup Accounting Expert
* \brief Balance by month
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
* \ingroup Advanced accountancy
* \brief Balance by month
*/
require '../../main.inc.php';

View File

@ -203,7 +203,7 @@ $formventilation = new FormVentilation($db);
* Confirmation to delete the command
*/
if ($action == 'delete') {
$formconfirm = Form::formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
@ -248,13 +248,13 @@ if ($action == 'create') {
print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>';
print Form::selectDate('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . Form::selectarray('code_journal', $code_journal_array) . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>';
print '<tr>';
@ -333,7 +333,7 @@ if ($action == 'create') {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte"));
print_liste_field_titre($langs->trans("AccountAccountingShort"));
print_liste_field_titre($langs->trans("Code_tiers"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');

View File

@ -87,24 +87,8 @@ $formventilation = new FormVentilation($db);
$formother = new FormOther($db);
$form = new Form($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
}
if (empty($search_date_start)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
@ -178,9 +162,30 @@ if (! empty($search_mvt_num)) {
$options .= '&amp;search_mvt_num=' . $search_mvt_num;
}
/*
* Action
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
}
if ($action == 'delbookkeeping') {
$import_key = GETPOST('importkey', 'alpha');
@ -193,7 +198,8 @@ if ($action == 'delbookkeeping') {
Header("Location: list.php");
exit();
}
} elseif ($action == 'delbookkeepingyearconfirm') {
}
if ($action == 'delbookkeepingyearconfirm') {
$delyear = GETPOST('delyear', 'int');
@ -205,7 +211,8 @@ if ($action == 'delbookkeeping') {
Header("Location: list.php");
exit();
}
} elseif ($action == 'delmouvconfirm') {
}
if ($action == 'delmouvconfirm') {
$mvt_num = GETPOST('mvt_num', 'int');
@ -217,7 +224,8 @@ if ($action == 'delbookkeeping') {
Header("Location: list.php");
exit();
}
} elseif ($action == 'export_csv') {
}
if ($action == 'export_csv') {
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
@ -228,251 +236,171 @@ if ($action == 'delbookkeeping') {
}
else
{
if (in_array($conf->global->ACCOUNTING_EXPORT_MODELCSV, array(5,6))) // TODO remove the conditional and keep the code in the "else"
{
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines);
if (!empty($accountancyexport->errors)) setEventMessages('', $accountancyexport->errors, 'errors');
else exit;
}
}
// TODO remove next 3 lines and foreach to implement the AccountancyExport method for each model
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
foreach ( $object->lines as $line ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
// Model Cegid Expert Export
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
print ' ' . $sep;
print $line->sens . $sep;
print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep;
print $line->doc_ref . $sep;
print length_accountg($line->numero_compte) . $sep;
print length_accounta($line->code_tiers) . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print $line->code_journal . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
// Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
print $line->piece_num . $sep;
print $line->doc_ref . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print 'E' . $sep;
print length_accountg($line->code_tiers) . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 4) {
// Bob50
print $line->piece_num . $sep;
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
if (empty($line->code_tiers)) {
print 'G' . $sep;
print length_accounta($line->numero_compte) . $sep;
} else {
if (substr($line->numero_compte,0,3)=='411') {
print 'C' . $sep;
}
if (substr($line->numero_compte,0,3)=='401') {
print 'F' . $sep;
}
print length_accountg($line->code_tiers) . $sep;
}
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print "\n";
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines);
if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors');
}
exit;
}
}
/*
* View
*/
else {
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
llxHeader('', $title_page);
llxHeader('', $title_page);
/*
* List
*/
// List
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'delmouv') {
$formconfirm = Form::formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array ();
$delyear = GETPOST('delyear');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$form_question['delyear'] = array (
'name' => 'delyear',
'type' => 'select',
'label' => $langs->trans('DelYear'),
'values' => $year_array,
'default' => $delyear
);
$formconfirm = Form::formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
print '<td class="liste_titre">';
print $langs->trans('From') . ': ';
print Form::selectDate($search_date_start, 'date_start', 0, 0, 1);
print '<br>';
print $langs->trans('To') . ': ';
print Form::selectDate($search_date_end, 'date_end', 0, 0, 1);
print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print '<br>';
print $langs->trans('To');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print '<br>';
print $langs->trans('To');
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$var = True;
$total_debit = 0;
$total_credit = 0;
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
print "<tr $bc[$var]>";
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="right">' . $line->code_journal . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="6"></td>';
print '<td align="right">';
print price($total_debit);
print '</td>';
print '<td align="right">';
print price($total_credit);
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
}
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array ();
$delyear = GETPOST('delyear');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$form_question['delyear'] = array (
'name' => 'delyear',
'type' => 'select',
'label' => $langs->trans('DelYear'),
'values' => $year_array,
'default' => $delyear
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
print '<td class="liste_titre">';
print $langs->trans('From') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print '<br>';
print $langs->trans('to') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print '<br>';
print $langs->trans('to');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print '<br>';
print $langs->trans('to');
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print '</tr>';
$var = True;
$total_debit = 0;
$total_credit = 0;
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
print "<tr $bc[$var]>";
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="center">' . $line->code_journal . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="6"></td>';
print '<td align="right">';
print price($total_debit);
print '</td>';
print '<td align="right">';
print price($total_credit);
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
$db->close();

View File

@ -176,9 +176,9 @@ print_barre_liste($langs->trans("Bookkeeping") . ' ' . dol_print_date($search_da
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print Form::selectDate($search_date_start, 'date_start');
print $form->select_date($search_date_start, 'date_start');
print $langs->trans('DateEnd') . ': ';
print Form::selectDate($search_date_end, 'date_end');
print $form->select_date($search_date_end, 'date_end');
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
@ -220,7 +220,7 @@ print '<input type="text" size=7 class="flat" name="search_doc_type" value="' .
print '</td>';
print '<td class="liste_titre">';
print Form::selectDate($search_doc_date, 'doc_date', 0, 0, 1);
print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
print '</td>';
print '<td class="liste_titre">';

View File

@ -0,0 +1,386 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/class/accountancycategory.class.php
* \ingroup Advanced accountancy
* \brief File of class to manage categories of an accounting category_type
*/
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
/**
* Class to manage categories of an accounting account
*/
class AccountancyCategory
{
private $db;
public $error;
public $errors = array();
//public $element='accounting_category';
//public $table_element='c_accounting_category';
public $id;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
return 1;
}
/**
* Function to select all accounting accounts from an accounting category
*
* @param int $id Id
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function display($id)
{
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql.= " WHERE t.fk_accounting_category = " . $id;
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
if ($num) {
while ( $i < $num ) {
$obj[$i] = $this->db->fetch_object($resql);
$i ++;
}
}
return $obj;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
/**
* Function to select accountiing category of an accounting account present in chart of accounts
*
* @param int $id Id category
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function getCptBK($id)
{
global $conf;
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql.= " WHERE t.numero_compte NOT IN (";
$sql.= " SELECT t.account_number";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql.= " WHERE t.fk_accounting_category = " . $id .")";
$sql.= " AND t.numero_compte IN (";
$sql.= " SELECT DISTINCT aa.account_number";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql.= " AND aa.active = 1)";
$sql.= " GROUP BY t.numero_compte";
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
if ($num) {
while ( $i < $num ) {
$obj[$i] = $this->db->fetch_object($resql);
$i ++;
}
}
return $obj;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
/**
* Function to add an accounting account in an accounting category
*
* @param int $id_cat Id category
* @param array $cpts list of accounts array
*
* @return int <0 if KO, >0 if OK
*/
public function updateAccAcc($id_cat, $cpts = array())
{
global $conf;
$error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql.= " AND aa.active = 1";
$sql.= " SET fk_accounting_category=" . $id_cat;
$sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")";
$this->db->begin();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$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(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->db->commit();
return 1;
}
}
/**
* Function to delete an accounting account from an accounting category
*
* @param int $cpt_id Id of accounting account
*
* @return int <0 if KO, >0 if OK
*/
public function deleteCptCat($cpt_id)
{
$error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql.= " SET fk_accounting_category= 0";
$sql.= " WHERE aa.rowid= " . $cpt_id;
$this->db->begin();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$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(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->db->commit();
return 1;
}
}
/**
* Function to know all category from accounting account
*
* @return array Result in table
*/
public function getCatsCpts()
{
global $mysoc;
$sql = "";
if (empty($mysoc->country_id) && empty($mysoc->country_code))
{
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
exit;
}
if (! empty($mysoc->country_id))
{
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
$sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql.= " WHERE c.active = 1";
$sql.= " AND c.fk_country = ".$mysoc->country_id.")";
$sql.= " AND cat.rowid = t.fk_accounting_category";
$sql.= " ORDER BY cat.position ASC";
}
else
{
$sql = "SELECT c.rowid, c.code, c.label, c.category_type ";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
$sql.= " AND co.code = '".$mysoc->country_code."'";
$sql.= " ORDER BY c.position ASC";
}
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array();
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$name_cat = $obj->name_cat;
$data[$name_cat][$i] = array(
'id' => $obj->rowid,
'code' => $obj->code,
'position' => $obj->position,
'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt,
'sens' => $obj->sens,
);
$i ++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
/**
* Function to show result of an accounting account from the general ledger with a sens and a period
*
* @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty
* @param string $year Specific year
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
*
* @return array Result in table
*/
public function getResult($cpt, $month, $year, $sens)
{
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql.= " WHERE t.numero_compte = " . $cpt;
$sql.= " AND YEAR(t.doc_date) = " . $year;
if(! empty($month)){
$sql.= " AND MONTH(t.doc_date) = " . $month;
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$sdc = 0;
if ($num) {
$obj = $this->db->fetch_object($resql);
if($sens == 1){
$sdc = $obj->debit - $obj->credit;
}else{
$sdc = $obj->credit - $obj->debit;
}
}
return $sdc;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
/**
* Function to call category from a specific country
*
* @return array Result in table
*/
public function getCatsCal()
{
global $db,$langs,$user,$mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code))
{
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
exit;
}
if (! empty($mysoc->country_id))
{
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql.= " WHERE c.active = 1 AND c.category_type = 1 ";
$sql.= " AND c.fk_country = ".$mysoc->country_id;
$sql.= " ORDER BY c.position ASC";
}
else
{
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
$sql.= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
$sql.= " AND co.code = '".$mysoc->country_code."'";
$sql.= " ORDER BY c.position ASC";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array();
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$position = $obj->position;
$data[$position] = array(
'code' => $obj->code,
'label' => $obj->label,
'formula' => $obj->formula
);
$i ++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
}

View File

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
/*
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -12,7 +13,7 @@
*
* 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
* 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
@ -20,7 +21,7 @@
*/
/**
* \file htdocs/accountancy/class/accountancyexport.class.php
* \file htdocs/accountancy/class/accountancyexport.class.php
*/
/**
@ -29,30 +30,34 @@
* Manage the different format accountancy export
*/
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
class AccountancyExport
{
/**
*
* @var Type of export
*/
public static $EXPORT_TYPE_NORMAL = 1;
public static $EXPORT_TYPE_CEGID = 2;
public static $EXPORT_TYPE_COALA = 3;
public static $EXPORT_TYPE_BOB50 = 4;
public static $EXPORT_TYPE_CIEL = 5;
public static $EXPORT_TYPE_QUADRATUS = 6;
public static $EXPORT_TYPE_NORMAL = 1;
public static $EXPORT_TYPE_CEGID = 2;
public static $EXPORT_TYPE_COALA = 3;
public static $EXPORT_TYPE_BOB50 = 4;
public static $EXPORT_TYPE_CIEL = 5;
public static $EXPORT_TYPE_QUADRATUS = 6;
public static $EXPORT_TYPE_EBP = 7;
/**
*
* @var string[] Error codes (or messages)
*/
public $errors = array();
public $errors = array ();
/**
*
* @var string Separator
*/
public $separator = '';
/**
*
* @var string End of line
*/
public $end_line = '';
@ -62,14 +67,12 @@ class AccountancyExport
*
* @param DoliDb $db Database handler
*/
public function __construct(DoliDB &$db)
{
public function __construct(DoliDB &$db) {
global $conf;
$this->db = &$db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = "\n";
return 1;
}
/**
@ -77,17 +80,17 @@ class AccountancyExport
*
* @return array of type
*/
public static function getType()
{
public static function getType() {
global $langs;
return array (
self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus')
self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
);
}
@ -96,8 +99,7 @@ class AccountancyExport
*
* @return void
*/
public static function downloadFile()
{
public static function downloadFile() {
global $conf;
$journal = 'bookkepping';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
@ -108,111 +110,168 @@ class AccountancyExport
*
* @param unknown $TData data
*/
public function export(&$TData)
{
public function export(&$TData) {
global $conf, $langs;
self::downloadFile();
switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
case self::$EXPORT_TYPE_NORMAL:
case self::$EXPORT_TYPE_NORMAL :
$this->exportNormal($TData);
break;
case self::$EXPORT_TYPE_CEGID:
case self::$EXPORT_TYPE_CEGID :
$this->exportCegid($TData);
break;
case self::$EXPORT_TYPE_COALA:
case self::$EXPORT_TYPE_COALA :
$this->exportCoala($TData);
break;
case self::$EXPORT_TYPE_BOB50:
case self::$EXPORT_TYPE_BOB50 :
$this->exportBob50($TData);
break;
case self::$EXPORT_TYPE_CIEL:
case self::$EXPORT_TYPE_CIEL :
$this->exportCiel($TData);
break;
case self::$EXPORT_TYPE_QUADRATUS:
case self::$EXPORT_TYPE_QUADRATUS :
$this->exportQuadratus($TData);
break;
default:
case self::$EXPORT_TYPE_EBP :
$this->exportEbp($TData);
break;
default :
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
}
if (empty($this->errors)) self::downloadFile();
}
/**
* Export format : Normal
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportNormal(&$TData)
{
public function exportNormal($objectLines) {
foreach ( $objectLines as $line ) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $this->separator;
print $line->doc_ref . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print length_accounta($line->code_tiers) . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print $line->code_journal . $this->separator;
print $this->end_line;
}
}
/**
* Export format : CEGID
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportCegid(&$TData)
{
public function exportCegid($objectLines) {
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print ' ' . $this->separator;
print $line->sens . $this->separator;
print price($line->montant) . $this->separator;
print dol_trunc($line->label_compte, 32) . $this->separator;
print $line->doc_ref . $this->separator;
print $this->end_line;
}
}
/**
* Export format : COALA
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportCoala(&$TData)
{
public function exportCoala($objectLines) {
// Coala export
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print $line->piece_num . $this->separator;
print $line->doc_ref . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print 'E' . $this->separator;
print length_accountg($line->code_tiers) . $this->separator;
print $this->end_line;
}
}
/**
* Export format : BOB50
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportBob50(&$TData)
{
public function exportBob50($objectLines) {
// Bob50
foreach ( $objectLines as $line ) {
print $line->piece_num . $this->separator;
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator;
if (empty($line->code_tiers)) {
print 'G' . $this->separator;
print length_accounta($line->numero_compte) . $this->separator;
} else {
if (substr($line->numero_compte, 0, 3) == '411') {
print 'C' . $this->separator;
}
if (substr($line->numero_compte, 0, 3) == '401') {
print 'F' . $this->separator;
}
print length_accountg($line->code_tiers) . $this->separator;
}
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print dol_trunc($line->label_compte, 32) . $this->separator;
print $this->end_line;
}
}
/**
* Export format : CIEL
*
* @param unknown $TData data
* @param array $TData data
*
* @return void
*/
public function exportCiel(&$TData)
{
public function exportCiel(&$TData) {
global $conf;
$i=1;
$i = 1;
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
foreach ($TData as $data)
{
foreach ( $TData as $data ) {
$code_compta = $data->numero_compte;
if (!empty($data->code_tiers)) $code_compta = $data->code_tiers;
if (! empty($data->code_tiers))
$code_compta = $data->code_tiers;
$Tab = array();
$Tab = array ();
$Tab['num_ecriture'] = str_pad($i, 5);
$Tab['code_journal'] = str_pad($data->code_journal, 2);
$Tab['date_ecriture'] = $date_ecriture;
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.$data->label_compte, 25), 25);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_compte, 25), 25);
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
$Tab['type_montant'] = str_pad($data->sens, 1);
$Tab['vide'] = str_repeat(' ', 18);
@ -222,41 +281,42 @@ class AccountancyExport
$Tab['end_line'] = $this->end_line;
print implode($Tab);
$i++;
$i ++;
}
}
/**
* Export format : Quadratus
*
* @param unknown $TData data
* @param array $TData data
*
* @return void
*/
public function exportQuadratus(&$TData)
{
public function exportQuadratus(&$TData) {
global $conf;
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ($TData as $data)
{
foreach ( $TData as $data ) {
$code_compta = $data->numero_compte;
if (!empty($data->code_tiers)) $code_compta = $data->code_tiers;
if (! empty($data->code_tiers))
$code_compta = $data->code_tiers;
$Tab = array();
$Tab = array ();
$Tab['type_ligne'] = 'M';
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
$Tab['folio'] = '000';
$Tab['date_ecriture'] = $date_ecriture;
$Tab['filler'] = ' ';
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_compte, 20), 20);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20);
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
$Tab['montant'] = str_pad(abs($data->montant)*100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['montant'] = str_pad(abs($data->montant) * 100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['contrepartie'] = str_repeat(' ', 8);
if (!empty($data->date_echeance)) $Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
else $Tab['date_echeance'] = '000000';
if (! empty($data->date_echeance))
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
else
$Tab['date_echeance'] = '000000';
$Tab['lettrage'] = str_repeat(' ', 5);
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
$Tab['filler2'] = str_repeat(' ', 20);
@ -264,7 +324,7 @@ class AccountancyExport
$Tab['devis'] = str_pad($conf->currency, 3);
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
$Tab['filler3'] = str_repeat(' ', 3);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_compte, 32), 32);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 32), 32);
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
$Tab['filler4'] = str_repeat(' ', 73);
@ -274,14 +334,45 @@ class AccountancyExport
}
}
/**
* Export format : Normal
*
* @param array $objectLines data
*
* @return void
*/
public function exportEbp($objectLines) {
$this->separator = ',';
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
print '"'.dol_trunc($line->label_compte,40,'right','UTF-8',1).'"' . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1)."'".$this->separator;
print price2num($line->montant).$this->separator;
print $line->sens.$this->separator;
print $date . $this->separator;
print 'EUR';
print $this->end_line;
}
}
/**
*
* @param unknown $str data
* @param unknown $size data
* @param integer $size data
*/
public static function trunc($str, $size)
{
public static function trunc($str, $size) {
return dol_trunc($str, $size, 'right', 'UTF-8', 1);
}
}

View File

@ -18,9 +18,9 @@
*/
/**
* \file htdocs/accountancy/class/accountancysystem.class.php
* \ingroup Accounting Expert
* \brief File of class to manage accountancy systems
* \file htdocs/accountancy/class/accountancysystem.class.php
* \ingroup Advanced accountancy
* \brief File of class to manage accountancy systems
*/
/**

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/class/accountingaccount.class.php
* \ingroup Accounting Expert
* \brief Fichier de la classe des comptes comptable
* \file htdocs/accountancy/class/accountingaccount.class.php
* \ingroup Advanced accountancy
* \brief File of class to manage accounting accounts
*/
/**
@ -41,6 +41,7 @@ class AccountingAccount extends CommonObject
var $pcg_subtype;
var $account_number;
var $account_parent;
var $account_category;
var $label;
var $fk_user_author;
var $fk_user_modif;
@ -58,25 +59,29 @@ class AccountingAccount extends CommonObject
/**
* Load record in memory
*
* @param int $rowid Id
* @param string $account_number Account number
* @param int $limittocurentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, >0 if OK
* @param int $rowid Id
* @param string $account_number Account number
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid = null, $account_number = null, $limittocurentchart = 0) {
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
global $conf;
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 . "accounting_account WHERE";
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
$sql .= ", ca.label as category_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
$sql .= " WHERE";
if ($rowid) {
$sql .= " rowid = '" . $rowid . "'";
$sql .= " a.rowid = '" . $rowid . "'";
} elseif ($account_number) {
$sql .= " account_number = '" . $account_number . "'";
$sql .= " a.account_number = '" . $account_number . "'";
}
if (! empty($limittocurentchart)) {
$sql .= ' AND fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
if (! empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@ -93,6 +98,8 @@ class AccountingAccount extends CommonObject
$this->account_number = $obj->account_number;
$this->account_parent = $obj->account_parent;
$this->label = $obj->label;
$this->account_category = $obj->fk_accounting_category;
$this->account_category_label = $obj->category_label;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif;
$this->active = $obj->active;
@ -110,7 +117,7 @@ class AccountingAccount extends CommonObject
}
/**
* Insert line in accounting_account
* Insert new accounting account in chart of accounts
*
* @param User $user Use making action
* @param int $notrigger Disable triggers
@ -134,6 +141,8 @@ class AccountingAccount extends CommonObject
$this->account_parent = trim($this->account_parent);
if (isset($this->label))
$this->label = trim($this->label);
if (isset($this->account_category))
$this->account_category = trim($this->account_category);
if (isset($this->fk_user_author))
$this->fk_user_author = trim($this->fk_user_author);
if (isset($this->active))
@ -153,6 +162,7 @@ class AccountingAccount extends CommonObject
$sql .= ", account_number";
$sql .= ", account_parent";
$sql .= ", label";
$sql .= ", fk_accounting_category";
$sql .= ", fk_user_author";
$sql .= ", active";
@ -166,6 +176,7 @@ class AccountingAccount extends CommonObject
$sql .= ", " . (! isset($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
$sql .= ", " . (! isset($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
$sql .= ", " . (! isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (! isset($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
$sql .= ", " . $user->id;
$sql .= ", " . (! isset($this->active) ? 'NULL' : "'" . $this->db->escape($this->active) . "'");
@ -226,6 +237,7 @@ class AccountingAccount extends CommonObject
$sql .= " , account_number = '" . $this->account_number . "'";
$sql .= " , account_parent = '" . $this->account_parent . "'";
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
$sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = '" . $this->active . "'";

View File

@ -1,8 +1,7 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
/* Copyright (C) 2014-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015-2016 Florian Henry <florian.henry@open-concept.pro>
*
* 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,21 +18,16 @@
*/
/**
* \file accountancy/bookkeeping.class.php
* \ingroup accountancy
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
* Put some comments here
* \file htdocs/accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy
* \brief File of class to manage general ledger
*/
// Put here all includes required by your class file
// Class
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
// require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
// require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/**
* Class Accountingbookkeeping
*
* Put here description of your class
* Class to manage general ledger
*/
class BookKeeping extends CommonObject
{
@ -461,7 +455,7 @@ class BookKeeping extends CommonObject
*
* @param int $id Id object
* @param string $ref Ref
*
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = null) {
@ -1207,6 +1201,48 @@ class BookKeeping extends CommonObject
return - 1;
}
}
/**
* Description of accounting account
*
* @param string $account Accounting account
* @return string
*/
function get_compte_desc($account = null)
{
global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND aa.account_number = '" . $account . "'";
$sql .= " AND asy.rowid = " . $pcgver;
$sql .= " AND aa.active = 1";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$obj = '';
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
}
if(empty($obj->category)){
return $obj->label;
}else{
return $obj->label.' ('.$obj->category.')';
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
}
/**

View File

@ -3,6 +3,7 @@
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/class/html.formventilation.class.php
* \ingroup Accounting Expert
* \brief File of class with all html predefined components
* \file htdocs/accountancy/class/html.formventilation.class.php
* \ingroup Advanced accountancy
* \brief File of class with all html predefined components
*/
/**
@ -29,18 +30,6 @@
*/
class FormVentilation extends Form
{
var $db;
var $error;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db) {
$this->db = $db;
}
/**
* Return select filter with date of transaction
*
@ -49,38 +38,25 @@ class FormVentilation extends Form
* @return string HTML edit field
*/
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
$options = array();
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
$sql .= ' ORDER BY import_key DESC';
$out = '<SELECT name="' . $htmlname . '">';
dol_syslog(get_class($this) . "::select_bookkeeping_importkey sql=" . $sql, LOG_DEBUG);
dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$num = $this->db->num_rows($resql);
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$selected = '';
if ($selectedkey == $obj->import_key) {
$selected = ' selected ';
}
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key, 'dayhourtext') . '</OPTION>';
$i ++;
}
} else {
if (!$resql) {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR);
return - 1;
}
$out .= '</SELECT>';
return $out;
while ($obj = $this->db->fetch_object($resql)) {
$options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext');
}
return Form::selectarray($htmlname, $options, $selectedkey);
}
/**
@ -100,8 +76,8 @@ class FormVentilation extends Form
global $conf;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
$out = '';
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
@ -110,49 +86,44 @@ class FormVentilation extends Form
$sql .= " AND aa.active = 1";
$sql .= " ORDER BY aa.account_number";
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql);
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
$label = dol_trunc($label, $trunclength);
if ($select_in == 0)
$select_value_in = $obj->rowid;
if ($select_in == 1)
$select_value_in = $obj->account_number;
if ($select_out == 0)
$select_value_out = $obj->rowid;
if ($select_out == 1)
$select_value_out = $obj->account_number;
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
// Because same account_number can be share between different accounting_system and do have the same meaning
if (($selectid != '') && $selectid == $select_value_in) {
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
} else {
// $out .= '<option value="' . $obj->account_number . '">' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '">' . $label . '</option>';
}
$i ++;
}
}
$out .= '</select>';
} else {
if (!$resql) {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
return - 1;
return -1;
}
$out = ajax_combobox($htmlname, $event);
$options = array();
$selected = null;
while ($obj = $this->db->fetch_object($resql)) {
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
$label = dol_trunc($label, $trunclength);
$select_value_in = $obj->rowid;
$select_value_out = $obj->rowid;
if ($select_in == 1) {
$select_value_in = $obj->account_number;
}
if ($select_out == 1) {
$select_value_out = $obj->account_number;
}
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
// Because same account_number can be share between different accounting_system and do have the same meaning
if (($selectid != '') && $selectid == $select_value_in) {
$selected = $select_value_out;
}
$options[$select_value_out] = $label;
}
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
$this->db->free($resql);
return $out;
}
@ -170,44 +141,30 @@ class FormVentilation extends Form
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) {
global $conf;
$out = '';
$sql = "SELECT DISTINCT pcg_type ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " ORDER BY pcg_type";
dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG);
dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->pcg_type;
if (($selectid != '') && $selectid == $obj->pcg_type) {
$out .= '<option value="' . $obj->pcg_type . '" selected>' . $label . '</option>';
} else {
$out .= '<option value="' . $obj->pcg_type . '">' . $label . '</option>';
}
$i ++;
}
}
$out .= '</select>';
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgtype " . $this->error, LOG_ERR);
return - 1;
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::select_pcgtype ".$this->error, LOG_ERR);
return -1;
}
$options = array();
$out = ajax_combobox($htmlname, $event);
while ($obj = $this->db->fetch_object($resql)) {
$options[$obj->pcg_type] = $obj->pcg_type;
}
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
$this->db->free($resql);
return $out;
}
@ -225,44 +182,30 @@ class FormVentilation extends Form
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
global $conf;
$out = '';
$sql = "SELECT DISTINCT pcg_subtype ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " ORDER BY pcg_subtype";
dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);
dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->pcg_subtype;
if (($selectid != '') && $selectid == $obj->pcg_subtype) {
$out .= '<option value="' . $obj->pcg_subtype . '" selected>' . $label . '</option>';
} else {
$out .= '<option value="' . $obj->pcg_subtype . '">' . $label . '</option>';
}
$i ++;
}
}
$out .= '</select>';
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
return - 1;
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
return -1;
}
$options = array();
$out = ajax_combobox($htmlname, $event);
while ($obj = $this->db->fetch_object($resql)) {
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
}
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
$this->db->free($resql);
return $out;
}
@ -278,68 +221,51 @@ class FormVentilation extends Form
* @return string String with HTML select
*/
function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) {
global $conf;
$out = '';
$aux_account = array ();
$aux_account = array();
// Auxiliary customer account
$sql = "SELECT DISTINCT code_compta, nom ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " ORDER BY code_compta";
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) {
if (! empty($obj->code_compta)) {
$aux_account[$obj->code_compta] = $obj->code_compta . ' (' . $obj->nom . ')';
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->code_compta)) {
$aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')';
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
return - 1;
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
return -1;
}
$this->db->free($resql);
// Auxiliary supplier account
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " ORDER BY code_compta";
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) {
if (! empty($obj->code_compta_fournisseur)) {
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur . ' (' . $obj->nom . ')';
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->code_compta_fournisseur)) {
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')';
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
return - 1;
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
return -1;
}
$this->db->free($resql);
// Build select
if (count($aux_account) > 0) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
foreach ( $aux_account as $key => $val ) {
if (($selectid != '') && $selectid == $key) {
$out .= '<option value="' . $key . '" selected>' . $val . '</option>';
} else {
$out .= '<option value="' . $key . '">' . $val . '</option>';
}
}
$out .= '</select>';
}
$out = ajax_combobox($htmlname, $event);
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
return $out;
}
@ -352,55 +278,29 @@ class FormVentilation extends Form
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
* @return string/array
*/
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') {
$out = '';
$out_array = array ();
if ($output_format == 'html') {
$out .= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"' . $option . ' >';
}
if ($useempty) {
$selected_html = '';
if ($selected == '') {
$selected_html = ' selected';
}
if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value=""' . $selected_html . '>&nbsp;</option>';
} elseif ($output_format == 'array') {
$out_array[''] = '';
}
}
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
{
$out_array = array();
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " ORDER BY doc_date";
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) {
$selected_html = '';
if ($selected > 0 && $obj->dtyear == $selected)
$selected_html = ' selected';
if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>';
} elseif ($output_format == 'array') {
$out_array[$obj->dtyear] = $obj->dtyear;
}
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
return - 1;
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {
$out_array[$obj->dtyear] = $obj->dtyear;
}
$this->db->free($resql);
if ($output_format == 'html') {
$out .= "</select>\n";
}
if ($output_format == 'html' || $output_format == 'options') {
return $out;
} elseif ($output_format == 'array') {
return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
} else {
return $out_array;
}
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -21,9 +21,9 @@
*/
/**
* \file htdocs/accountancy/customer/index.php
* \ingroup Accounting Expert
* \brief Home customer ventilation
* \file htdocs/accountancy/customer/index.php
* \ingroup Advanced accountancy
* \brief Home customer ventilation
*/
require '../../main.inc.php';
@ -44,7 +44,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->ventilation->read)
accessforbidden();
// Filter
// Filter
$year = $_GET["year"];
if ($year == 0) {
$year_current = strftime("%Y", time());
@ -95,7 +95,7 @@ if ($action == 'validatehistory') {
$sql1 .= " SET fd.fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -21,9 +21,9 @@
*/
/**
* \file htdocs/accountancy/customer/lines.php
* \ingroup Accounting Expert
* \brief Page of detail of the lines of ventilation of invoices customers
* \file htdocs/accountancy/customer/lines.php
* \ingroup Advanced accountancy
* \brief Page of detail of the lines of ventilation of invoices customers
*/
require '../../main.inc.php';
@ -31,6 +31,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("bills");
@ -267,14 +268,14 @@ if ($result) {
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_country" value="' . $search_country . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_tavintra" value="' . $search_tavintra . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_country" value="' . $search_country . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_tavintra" value="' . $search_tavintra . '"></td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print "</td></tr>\n";
@ -285,7 +286,7 @@ if ($result) {
$var = True;
while ( $objp = $db->fetch_object($result) ) {
$var = ! $var;
$codecompta = $objp->account_number . ' - ' . $objp->label_compte;
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
print "<tr $bc[$var]>";
@ -309,7 +310,7 @@ if ($result) {
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . price($objp->tva_tx) . '</td>';
print '<td align="center">' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
print '<td>' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
print img_edit();
print '</a></td>';
print '<td align="right">' . $objp->country .'</td>';

View File

@ -52,8 +52,9 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
$langs->load("companies");
$langs->load("other");
$langs->load("compta");
$langs->load("bank");
$langs->load("banks");
$langs->load('bills');
$langs->load('donations');
$langs->load("accountancy");
$id_bank_account = GETPOST('id_account', 'int');
@ -130,11 +131,12 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
$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"));
$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
$accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
$account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
$account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef"));
$tabpay = array ();
$tabbq = array ();
@ -154,11 +156,9 @@ if ($result) {
// Controls
$compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)')
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $cptfour);
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
if ($obj->label == '(CustomerInvoicePayment)')
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli);
if ($obj->typeop == '(BankTransfert)')
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
// Variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do;
@ -226,25 +226,23 @@ if ($result) {
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation");
$tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount;
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
} else if ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
} else if ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
$tabtp[$obj->rowid][$account_employee] += $obj->amount;
} else if ($links[$key]['type'] == 'banktransfert') {
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
}
@ -420,12 +418,27 @@ if ($action == 'export_csv') {
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$reflabel = $val["ref"];
if ($reflabel == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('Supplier');
}
if ($reflabel == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('Customer');
}
if ($reflabel == '(SocialContributionPayment)') {
$reflabel = $langs->trans('SocialContribution');
}
if ($reflabel == '(DonationPayment)') {
$reflabel = $langs->trans('Donation');
}
if ($reflabel == '(SubscriptionPayment)') {
$reflabel = $langs->trans('Donation');
}
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
@ -434,8 +447,12 @@ if ($action == 'export_csv') {
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print utf8_decode($val["ref"]) . $sep;
if ($companystatic->name == '') {
print $langs->trans('Bank')." - ". utf8_decode($val["ref"]) . $sep;
} else {
print $langs->trans("Bank") .' - '.utf8_decode($companystatic->name) . $sep;
}
print utf8_decode($reflabel) . $sep;
print "\n";
}
@ -445,33 +462,45 @@ if ($action == 'export_csv') {
if ($mt) {
print $date . $sep;
print $journal . $sep;
if ($val["lib"] == '(SupplierInvoicePayment)') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
} else {
if ($tabtype[$key] == 'payment') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
} else if ($tabtype[$key] == 'payment_supplier') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
} else {
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
}
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print utf8_decode($val["ref"]) . $sep;
if ($companystatic->name == '') {
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
} else {
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
}
print utf8_decode($reflabel) . $sep;
print "\n";
}
}
} else {
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print utf8_decode($val["ref"]) . $sep;
print "\n";
print $date . $sep;
print $journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
if ($companystatic->name == '') {
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
} else {
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
}
print utf8_decode($reflabel) . $sep;
print "\n";
}
}
}
} else {
// Model Classic Export
foreach ( $tabpay as $key => $val ) {
@ -482,6 +511,7 @@ if ($action == 'export_csv') {
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
@ -490,7 +520,6 @@ if ($action == 'export_csv') {
} else {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
}
// print '"' . $langs->trans("Bank") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
@ -500,10 +529,10 @@ if ($action == 'export_csv') {
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
// print '"' . $companystatic->name . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
} else {
@ -516,10 +545,10 @@ if ($action == 'export_csv') {
}
} else {
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
// print '"' . $langs->trans("Bank") . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
} else {
@ -541,7 +570,7 @@ else {
$nom = $langs->trans("FinanceJournal") . ' - ' . $bank_code_journal->getNomUrl(1);
$builddate = time();
$description = $langs->trans("DescFinanceJournal") . '<br>';
$period = Form::selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . Form::selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
$varlink = 'id_account=' . $id_bank_account;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
@ -588,24 +617,33 @@ else {
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
if ($val["lib"] == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('SupplierInvoicePayment');
$reflabel = $val["ref"];
if ($reflabel == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('Supplier');
}
if ($val["lib"] == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('CustomerInvoicePayment');
if ($reflabel == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('Customer');
}
if ($reflabel == '(SocialContributionPayment)') {
$reflabel = $langs->trans('SocialContribution');
}
if ($reflabel == '(DonationPayment)') {
$reflabel = $langs->trans('Donation');
}
if ($reflabel == '(SubscriptionPayment)') {
$reflabel = $langs->trans('SubscriptionPayment');
}
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $ref . "</td>";
print "<td>" . length_accountg($k) . "</td>";
// print "<td>" . $langs->trans('Bank') . "</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('Bank') . " - " . $val["ref"] . "</td>";
print "<td>" . $bank_code_journal->label . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
print "<td>" . $bank_code_journal->label . " - " . $val['soclib'] . "</td>";
}
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
@ -619,19 +657,9 @@ else {
if ($k != 'type') {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>";
// print "<td>" . length_accounta($k) . "</td>";
if (length_accounta($k) == '') {
print "<td>" . length_accounta($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) . "</td>";
} else {
print "<td>" . $ref . "</td>";
print "<td>" . length_accounta($k) . "</td>";
}
// print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "</td>";
}
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
@ -642,14 +670,9 @@ else {
foreach ( $tabbq[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $ref . "</td>";
print "<td>" . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . "</td>";
// print "<td>" . $langs->trans('ThirdParty') . "</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "</td>";
}
print "<td>" . $reflabel . "</td>";
print "<td>&nbsp;</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";

View File

@ -1,45 +0,0 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/accountancy/journal/index.php
* \ingroup Accounting Expert
* \brief Index
*/
require '../../main.inc.php';
// Langs
$langs->load("compta");
$langs->load("bills");
$langs->load("other");
$langs->load("main");
$langs->load("accountancy");
// Security check
if ($user->societe_id > 0)
accessforbidden();
llxHeader('', 'Journaux', '');
$form = new Form($db);
// End of page
llxFooter();
$db->close();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -23,7 +23,7 @@
/**
* \file htdocs/accountancy/journal/purchasesjournal.php
* \ingroup Accounting Expert
* \ingroup Advanced accountancy
* \brief Page with purchases journal
*/
require '../../main.inc.php';
@ -117,6 +117,7 @@ if ($result) {
$tabfac = array ();
$tabht = array ();
$tabtva = array ();
$def_tva = array ();
$tabttc = array ();
$tabcompany = array ();
@ -134,11 +135,13 @@ if ($result) {
}
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
//Define array for display vat tx
$def_tva[$obj->rowid]=price($obj->tva_tx);
$tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
$tabfac[$obj->rowid]["refsologest"] = $obj->ref ;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier ;
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->description;
@ -164,6 +167,21 @@ if ($action == 'writebookkeeping') {
$error = 0;
foreach ( $tabfac as $key => $val ) {
$companystatic = new Societe($db);
$invoicestatic = new FactureFournisseur($db);
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
foreach ( $tabttc[$key] as $k => $mt ) {
// get compte id and label
@ -175,7 +193,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
$bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
@ -193,6 +211,8 @@ if ($action == 'writebookkeeping') {
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
// get compte id and label
$accountingaccount = new AccountingAccount($db);
@ -205,7 +225,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = '';
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -236,7 +256,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = '';
$bookkeeping->label_compte = $langs->trans("VAT");
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
$bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -248,7 +268,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -267,124 +287,123 @@ $companystatic = new Fournisseur($db);
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
$sep = ";";
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
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 $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($val["description"], 32) . $sep;
print $val["ref"];
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
}
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($val["description"], 32) . $sep;
print $val["ref"];
print "\n";
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
}
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
}
print "\n";
}
}
} else {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$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 ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
}
print "\n";
}
}
} else {
llxHeader('', $langs->trans("PurchasesJournal"));
@ -403,12 +422,16 @@ if ($action == 'export_csv') {
$description .= $langs->trans("DepositsAreIncluded");
}
$period = Form::selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . Form::selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -453,7 +476,6 @@ if ($action == 'export_csv') {
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
@ -471,8 +493,8 @@ if ($action == 'export_csv') {
print "<td>" . length_accountg($k) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - ' .$invoicestatic->refsupplier .' - '. $accountingaccount->label . "</td>";
//print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
// print "<td>" . $accountingaccount->label . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
@ -484,8 +506,8 @@ if ($action == 'export_csv') {
print "<tr " . $bc[$var] . " >";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>" ;
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("VAT") . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
@ -499,11 +521,11 @@ if ($action == 'export_csv') {
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . length_accounta($k)."</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("Code_tiers")."</td>";
//print "</td><td>" . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
//print "</td>";
print "<td>" . length_accounta($k) . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers") . "</td>";
// print "</td><td>" . $langs->trans("ThirdParty");
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
// print "</td>";
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}
@ -517,5 +539,4 @@ if ($action == 'export_csv') {
// End of page
llxFooter();
}
$db->close();

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Rapha<EFBFBD>l Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,9 +24,9 @@
*/
/**
* \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy
* \brief Page with sells journal
* \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy
* \brief Page with sells journal
*/
require '../../main.inc.php';
@ -118,6 +118,7 @@ if ($result) {
$tabfac = array ();
$tabht = array ();
$tabtva = array ();
$def_tva = array ();
$tabttc = array ();
$tabcompany = array ();
@ -140,17 +141,20 @@ if ($result) {
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
//Define array for display vat tx
$def_tva[$obj->rowid]=price($obj->tva_tx);
// Situation invoices handling
$line = new FactureLigne($db);
$line->fetch($obj->fdid); // id of line
$prev_progress = 0;
$line->fetch($obj->fdid);
$prev_progress = $line->get_prev_progress($obj->fdid);
if ($obj->type == Facture::TYPE_SITUATION) {
// Avoid divide by 0
// Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
$situation_ratio = 1;
@ -194,6 +198,17 @@ if ($action == 'writebookkeeping') {
$error = 0;
foreach ( $tabfac as $key => $val ) {
$companystatic = new Societe($db);
$invoicestatic = new Facture($db);
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@ -204,7 +219,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = $tabcompany[$key]['name'];
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@ -234,7 +250,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -264,7 +280,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $langs->trans("VAT");
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -275,7 +291,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -288,6 +304,7 @@ if ($action == 'writebookkeeping') {
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
@ -296,8 +313,7 @@ if ($action == 'export_csv') {
$companystatic = new Client($db);
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
foreach ( $tabfac as $key => $val ) {
@ -305,6 +321,9 @@ if ($action == 'export_csv') {
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
foreach ( $tabttc[$key] as $k => $mt ) {
@ -314,7 +333,8 @@ if ($action == 'export_csv') {
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
// print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
@ -329,7 +349,8 @@ if ($action == 'export_csv') {
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($accountingaccount_static->label, 32) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount_static->label)) . $sep;
// print dol_trunc($accountingaccount_static->label, 32) . $sep;
print $val["ref"];
print "\n";
}
@ -344,27 +365,31 @@ if ($action == 'export_csv') {
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $langs->trans("VAT") . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
// print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
}
} else {
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), 'day');
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $companystatic->ref_client . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
@ -379,8 +404,8 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. utf8_decode ( dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@ -393,8 +418,8 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. $langs->trans("VAT") . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@ -418,12 +443,16 @@ if ($action == 'export_csv') {
$description .= $langs->trans("DepositsAreNotIncluded");
else
$description .= $langs->trans("DepositsAreIncluded");
$period = Form::selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . Form::selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -479,9 +508,9 @@ if ($action == 'export_csv') {
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
print "<td>" . length_accounta($k);
//print "</td><td>" . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref_client . ' - ' . $langs->trans("Code_tiers"). "</td>";
// print "</td><td>" . $langs->trans("ThirdParty");
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>";
print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
}
@ -497,8 +526,8 @@ if ($action == 'export_csv') {
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
//print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "</td>";
// print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount->label)) . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
@ -512,8 +541,8 @@ if ($action == 'export_csv') {
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client .' - '. $langs->trans("VAT") . "</td>";
//print "<td>" . $langs->trans("VAT") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . ' '.$def_tva[$key]. "</td>";
// print "<td>" . $langs->trans("VAT") . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";

View File

View File

@ -0,0 +1,240 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/report/result.php
* \ingroup Advanced accountancy
* \brief Page for accounting result
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$error = 0;
// Langs
$langs->load("accountancy");
$langs->load("compta");
$mesg = '';
$action = GETPOST('action');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
// Filter
$year = $_GET["year"];
if ($year == 0) {
$year_current = strftime("%Y", time());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
}
if($cat_id == 0){
$cat_id = null;
}
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
$AccCat = new AccountancyCategory($db);
/*
* View
*/
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
print load_fiche_titre($langs->trans('ReportInOut') . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
print '<table class="border" width="100%">';
$months = array( $langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Account").'</th>';
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
print '<th class="liste_titre" align="center">N-1</th>';
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
}
print '</tr>';
$cats = $AccCat->getCatsCpts();
$catsCalcule = $AccCat->getCatsCal();
$j=1;
$sommes = array();
if(!empty($cats))
{
foreach ( $cats as $name_cat => $cpts )
{
print "<tr class='liste_titre'>";
print '<td colspan="17">' . $name_cat . '</td>';
print "</tr>\n";
$position = -1;
$code = -1;
foreach($cpts as $i => $cpt){
$var = ! $var;
$position = $cpt['position'];
$code = $cpt['code'];
$resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
print "<tr $bc[$var]>";
print '<td>' . $cpt['account_number'] . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td>' . price($resultNP) . '</td>';
print '<td>' . price($resultN) . '</td>';
foreach($months as $k => $v){
$resultM = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
$sommes[$code]['M'][$k] += $resultM;
print '<td align="right">' . price($resultM) . '</td>';
}
print "</tr>\n";
}
// If it's a calculated catgory
$p = $position + 1;
if(array_key_exists($p, $catsCalcule)){
$formula = $catsCalcule[$p]['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$code = $catsCalcule[$p]['code']; // code categorie de calcule
$sommes[$code]['NP'] += $result;
// Current fiscal year (N)
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['N'] += $result;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['M'][$k] += $result;
}
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
print "</tr>\n";
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
}
$j++;
}
// Others calculed category
foreach($catsCalcule as $p => $catc)
{
$formula = $catsCalcule[$p]['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$code = $catsCalcule[$p]['code']; // code categorie de calcule
$sommes[$code]['NP'] += $result;
// Current fiscal year (N)
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['N'] += $result;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['M'][$k] += $result;
}
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
print "</tr>\n";
}
}
print "</table>";
llxFooter();
$db->close();

View File

@ -19,9 +19,9 @@
*/
/**
* \file htdocs/accountancy/supplier/index.php
* \ingroup Accounting Expert
* \brief Home supplier ventilation
* \file htdocs/accountancy/supplier/index.php
* \ingroup Advanced accountancy
* \brief Home supplier ventilation
*/
require '../../main.inc.php';
@ -42,7 +42,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->ventilation->read)
accessforbidden();
// Filter
// Filter
$year = $_GET["year"];
if ($year == 0) {
$year_current = strftime("%Y", time());
@ -91,7 +91,7 @@ if ($action == 'validatehistory') {
$sql1 .= " SET fd.fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/supplier/lines.php
* \ingroup Accounting Expert
* \brief Page of detail of the lines of ventilation of invoices suppliers
* \file htdocs/accountancy/supplier/lines.php
* \ingroup Advanced accountancy
* \brief Page of detail of the lines of ventilation of invoices suppliers
*/
require '../../main.inc.php';
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
@ -213,15 +214,15 @@ if ($result) {
print "</tr>\n";
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpitco=Form::showFilterAndCheckAddButtons();
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
@ -233,7 +234,7 @@ if ($result) {
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$codeCompta = $objp->account_number . ' - ' . $objp->label;
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
print "<tr $bc[$var]>";
@ -257,7 +258,7 @@ if ($result) {
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . price($objp->tva_tx) . '</td>';
print '<td align="center">' . $codeCompta . '</td>';
print '<td>' . $codeCompta . '</td>';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();

View File

@ -134,7 +134,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="constname" value="ADHERENT_LOGIN_NOT_REQUIRED">';
print '<tr '.$bc[$var].'><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
print Form::selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1);
print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1);
print '</td><td align="center" width="80">';
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
print "</td></tr>\n";
@ -147,7 +147,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="constname" value="ADHERENT_MAIL_REQUIRED">';
print '<tr '.$bc[$var].'><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
print Form::selectyesno('constvalue',(! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0),1);
print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0),1);
print '</td><td align="center" width="80">';
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
print "</td></tr>\n";
@ -160,7 +160,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="constname" value="ADHERENT_DEFAULT_SENDINFOBYMAIL">';
print '<tr '.$bc[$var].'><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
print Form::selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0),1);
print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0),1);
print '</td><td align="center" width="80">';
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
print "</td></tr>\n";
@ -178,7 +178,7 @@ if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly");
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice");
print '<td>';
print Form::selectarray('constvalue',$arraychoices,$conf->global->ADHERENT_BANK_USE,0);
print $form->selectarray('constvalue',$arraychoices,$conf->global->ADHERENT_BANK_USE,0);
print '</td><td align="center" width="80">';
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
print '</td>';
@ -197,7 +197,7 @@ if ($conf->facture->enabled)
if (! empty($conf->banque->enabled))
{
print '<td>';
print Form::selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
print $form->selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
print '</td><td align="center" width="80">';
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
print '</td>';

View File

@ -149,7 +149,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("EnablePublicSubscriptionForm");
print '</td><td align="right">';
print Form::selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
print "</td></tr>\n";
// Type
@ -158,7 +158,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].' class="drag"><td>';
print $langs->trans("EnablePublicSubscriptionForm");
print '</td><td width="60" align="center">';
print Form::selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1);
print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1);
print "</td></tr>\n"; */
// Amount
@ -176,7 +176,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].' id="tredit"><td>';
print $langs->trans("CanEditAmount");
print '</td><td align="right">';
print Form::selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
print "</td></tr>\n";
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
@ -189,7 +189,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
$listofval=array();
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
print Form::selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
print "</td></tr>\n";
}

View File

@ -105,7 +105,7 @@ if ($object->id > 0)
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
print Form::showphoto('memberphoto',$member);
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print '</tr>';

View File

@ -48,7 +48,7 @@ abstract class ActionsAdherentCardCommon
/**
* Instantiation of DAO class
* Instantiation of DAO class. Init ->object
*
* @return int 0
* @deprecated Using getInstanceDao should not be used.
@ -83,18 +83,18 @@ abstract class ActionsAdherentCardCommon
*/
function getObject($id)
{
$ret = $this->getInstanceDao();
//$ret = $this->getInstanceDao();
if (is_object($this->object) && method_exists($this->object,'fetch'))
/*if (is_object($this->object) && method_exists($this->object,'fetch'))
{
if (! empty($id)) $this->object->fetch($id);
}
else
{
{*/
$object = new Adherent($this->db);
if (! empty($id)) $object->fetch($id);
$this->object = $object;
}
//}
}
/**
@ -121,11 +121,11 @@ abstract class ActionsAdherentCardCommon
// Creation user
$nuser = new User($this->db);
$result=$nuser->create_from_member($this->object,$_POST["login"]);
$result=$nuser->create_from_member($this->object,GETPOST("login"));
if ($result > 0)
{
$result2=$nuser->setPassword($user,$_POST["password"],0,1,1);
$result2=$nuser->setPassword($user,GETPOST("password"),0,1,1);
if ($result2)
{
$this->db->commit();
@ -313,7 +313,7 @@ abstract class ActionsAdherentCardCommon
// Physical or Moral
$selectarray=array('0'=>$langs->trans("Physical"),'1'=>$langs->trans("Moral"));
$this->tpl['select_morphy'] = Form::selectarray('morphy',$selectarray,$this->object->morphy,0);
$this->tpl['select_morphy'] = $form->selectarray('morphy',$selectarray,$this->object->morphy,0);
}
if ($action == 'view' || $action == 'edit' || $action == 'delete')
@ -338,7 +338,7 @@ abstract class ActionsAdherentCardCommon
if ($action == 'view' || $action == 'delete')
{
$this->tpl['showrefnav'] = Form::showrefnav($this->object,'id');
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'id');
if ($this->object->socid > 0)
{
@ -385,7 +385,7 @@ abstract class ActionsAdherentCardCommon
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
$this->tpl['action_create_user'] = Form::formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateAdherent"),"confirm_create_user",$formquestion,'no');
$this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateAdherent"),"confirm_create_user",$formquestion,'no');
}
}
@ -424,13 +424,14 @@ abstract class ActionsAdherentCardCommon
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
}
else
{
dol_print_error($this->db);
}
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
}
}

View File

@ -108,7 +108,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
// Confirm delete contact
if ($action == 'delete' && $user->rights->adherent->supprimer)
{
$this->tpl['action_delete'] = Form::formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteAdherent"),$langs->trans("ConfirmDeleteAdherent"),"confirm_delete",'',0,1);
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteAdherent"),$langs->trans("ConfirmDeleteAdherent"),"confirm_delete",'',0,1);
}
}

View File

@ -356,13 +356,8 @@ if (empty($reshook))
}
else
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
// Create thumbs
$object->addThumbs($newfile);
}
}
}
@ -807,7 +802,7 @@ else
$listetype=$adht->liste_array();
if (count($listetype))
{
print Form::selectarray("typeid", $listetype, GETPOST('typeid','int')?GETPOST('typeid','int'):$typeid, count($listetype)>1?1:0);
print $form->selectarray("typeid", $listetype, GETPOST('typeid','int')?GETPOST('typeid','int'):$typeid, count($listetype)>1?1:0);
} else {
print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
}
@ -817,7 +812,7 @@ else
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td class="fieldrequired">'.$langs->trans("Nature")."</td><td>\n";
print Form::selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1);
print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1);
print "</td>\n";
// Company
@ -900,12 +895,12 @@ else
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
Form::selectDate(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";
// Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print Form::selectyesno("public",$object->public,1);
print $form->selectyesno("public",$object->public,1);
print "</td></tr>\n";
// Categories
@ -913,7 +908,7 @@ else
{
print '<tr><td>' . fieldLabel('Categories', 'memcars') . '</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
print Form::multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%');
print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%');
print "</td></tr>";
}
@ -1054,12 +1049,12 @@ else
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
print '<tr><td><span class="fieldrequired">'.$langs->trans("Nature").'</span></td><td>';
print Form::selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td>";
// Photo
print '<td align="center" class="hideonsmartphone" valign="middle" width="25%" rowspan="'.$rowspan.'">';
print Form::showphoto('memberphoto',$object)."\n";
print $form->showphoto('memberphoto',$object)."\n";
if ($caneditfieldmember)
{
if ($object->photo) print "<br>\n";
@ -1075,7 +1070,7 @@ else
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
if ($user->rights->adherent->creer)
{
print Form::selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->typeid));
print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->typeid));
}
else
{
@ -1154,12 +1149,12 @@ else
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
Form::selectDate(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";
// Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print Form::selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1);
print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1);
print "</td></tr>\n";
// Categories
@ -1173,7 +1168,7 @@ else
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print Form::multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>";
}
@ -1278,7 +1273,7 @@ else
if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser");
else $text.=$langs->trans("UserWillBeInternalUser");
}
print Form::formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes');
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes');
}
// Confirm create third party
@ -1297,7 +1292,7 @@ else
// Create a form array
$formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
print Form::formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
}
// Confirm validate member
@ -1322,7 +1317,7 @@ else
$helpcontent.="<br>";
$helpcontent.='<b>'.$langs->trans("Content").'</b>:<br>';
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
$label=Form::textwithpicto($tmp,$helpcontent,1,'help');
$label=$form->textwithpicto($tmp,$helpcontent,1,'help');
// Create form popup
$formquestion=array();
@ -1333,13 +1328,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("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
}
// Confirm send card by mail
if ($action == 'sendinfo')
{
print Form::formconfirm("card.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 terminate
@ -1364,13 +1359,13 @@ else
$helpcontent.="<br>";
$helpcontent.='<b>'.$langs->trans("Content").'</b>:<br>';
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
$label=Form::textwithpicto($tmp,$helpcontent,1,'help');
$label=$form->textwithpicto($tmp,$helpcontent,1,'help');
// Cree un tableau formulaire
$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("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
}
// Confirm remove member
@ -1378,23 +1373,18 @@ else
{
$formquestion=array();
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print Form::formconfirm("card.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);
}
/*
* Confirm add in spip
*/
// Confirm add in spip
if ($action == 'add_spip')
{
print Form::formconfirm("card.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');
}
/*
* Confirm removed from spip
*/
// Confirm removed from spip
if ($action == 'del_spip')
{
print Form::formconfirm("card.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;
@ -1439,7 +1429,7 @@ else
{
$langs->load("errors");
$htmltext=$langs->trans("WarningPasswordSetWithNoAccount");
print ' '.Form::textwithpicto('', $htmltext,1,'warning');
print ' '.$form->textwithpicto('', $htmltext,1,'warning');
}
print '</td></tr>';
}
@ -1556,8 +1546,16 @@ else
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
if (! $adht->cotisation)
{
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
}
print '</td></tr>';

View File

@ -605,7 +605,7 @@ if ($rowid > 0)
{
$langs->load("errors");
$htmltext=$langs->trans("WarningPasswordSetWithNoAccount");
print ' '.Form::textwithpicto('', $htmltext,1,'warning');
print ' '.$form->textwithpicto('', $htmltext,1,'warning');
}
print '</td></tr>';
}
@ -722,8 +722,16 @@ if ($rowid > 0)
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
if (! $adht->cotisation)
{
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
}
print '</td></tr>';
@ -929,7 +937,7 @@ if ($rowid > 0)
// Create a form array
$formquestion=array(array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
print Form::formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
}
@ -974,7 +982,7 @@ if ($rowid > 0)
$datefrom=$object->datevalid;
}
}
print Form::selectDate($datefrom,'','','','',"cotisation",1,1,1);
print $form->select_date($datefrom,'','','','',"cotisation",1,1,1);
print "</td></tr>";
// Date end subscription
@ -987,7 +995,7 @@ if ($rowid > 0)
$dateto=-1; // By default, no date is suggested
}
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
print Form::selectDate($dateto,'end','','','',"cotisation",1,0,1);
print $form->select_date($dateto,'end','','','',"cotisation",1,0,1);
print "</td></tr>";
if ($adht->cotisation)
@ -1088,7 +1096,7 @@ if ($rowid > 0)
// Date of payment
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print Form::selectDate(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1,1);
print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1,1);
print "</td></tr>\n";
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
@ -1134,7 +1142,7 @@ if ($rowid > 0)
$helpcontent.='<b>'.$langs->trans("MailText").'</b>:<br>';
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
print Form::textwithpicto($tmp,$helpcontent,1,'help');
print $form->textwithpicto($tmp,$helpcontent,1,'help');
}
print '</td></tr>';
print '</tbody>';

View File

@ -239,7 +239,7 @@ foreach(array_keys($_Avery_Labels) as $codecards)
{
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
}
print Form::selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>';
print '<br>';
@ -255,7 +255,7 @@ foreach(array_keys($_Avery_Labels) as $codecards)
{
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
}
print Form::selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>';
@ -272,7 +272,7 @@ foreach(array_keys($_Avery_Labels) as $codecards)
{
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
}
print Form::selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>';
print '<br>';

View File

@ -1577,7 +1577,7 @@ class Adherent extends CommonObject
if ($withpicto) $result.=($link.img_object('', $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
$result.=$link.(($withpicto != 2) ? ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref) : '').$linkend;
return $result;
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.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
@ -35,10 +36,14 @@ class AdherentType extends CommonObject
public $table_element = 'adherent_type';
public $element = 'adherent_type';
var $id;
var $ref;
var $libelle;
var $cotisation; // Soumis a la cotisation
var $vote; // droit de vote
var $mail_valid; //mail envoye lors de la validation
var $cotisation; // Soumis a la cotisation
var $note;
var $vote; // droit de vote
var $mail_valid; //mail envoye lors de la validation
var $statut;
/**
@ -110,7 +115,7 @@ class AdherentType extends CommonObject
$sql.= "note = '".$this->db->escape($this->note)."',";
$sql.= "vote = '".$this->vote."',";
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
$sql .= " WHERE rowid = $this->id";
$sql .= " WHERE rowid =".$this->id;
$result = $this->db->query($sql);
if ($result)
@ -164,7 +169,7 @@ class AdherentType extends CommonObject
return 1;
}
else
{
{
return 0;
}
}
@ -223,7 +228,7 @@ class AdherentType extends CommonObject
{
global $conf,$langs;
$projets = array();
$adherenttypes = array();
$sql = "SELECT rowid, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
@ -241,7 +246,7 @@ class AdherentType extends CommonObject
{
$obj = $this->db->fetch_object($resql);
$projets[$obj->rowid] = $langs->trans($obj->libelle);
$adherenttypes[$obj->rowid] = $langs->trans($obj->libelle);
$i++;
}
}
@ -250,8 +255,7 @@ class AdherentType extends CommonObject
{
print $this->db->error();
}
return $projets;
return $adherenttypes;
}
@ -308,7 +312,7 @@ class AdherentType extends CommonObject
function getMailOnSubscription()
{
global $conf;
// mail_subscription not defined so never used
if (! empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
{
return $this->mail_subscription;
@ -327,7 +331,7 @@ class AdherentType extends CommonObject
function getMailOnResiliate()
{
global $conf;
// NOTE mail_resiliate not defined so never used
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
{
return $this->mail_resiliate;

View File

@ -128,7 +128,9 @@ if ($result)
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
$param='';
$param.="&statut=$statut&date_select=$date_select";
if ($statut != '') $param.="&statut=".$statut;
if ($date_select) $param.="&date_select=".$date_select;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
if ($search_login) $param.="&search_login=".$search_login;
if ($search_acount) $param.="&search_account=".$search_account;
@ -200,7 +202,7 @@ if ($result)
// Action column
print '<td class="liste_titre" align="right">';
$searchpitco=Form::showFilterAndCheckAddButtons();
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
@ -214,7 +216,7 @@ if ($result)
$var=true;
$total=0;
while ($i < $num && $i < $conf->liste_limit)
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
$total+=$objp->cotisation;

View File

@ -76,7 +76,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$o
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
/*
@ -131,7 +131,7 @@ if ($id > 0)
// Morphy
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
print Form::showphoto('memberphoto',$object);
print $form->showphoto('memberphoto',$object);
print '</td>';*/
print '</tr>';

View File

@ -196,7 +196,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="3">';
print Form::showrefnav($subscription, 'rowid', $linkback, 1);
print $form->showrefnav($subscription, 'rowid', $linkback, 1);
print '</td></tr>';
// Member
@ -207,13 +207,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
// Date start subscription
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
Form::selectDate($subscription->dateh,'datesub',1,1,0,'update',1);
$form->select_date($subscription->dateh,'datesub',1,1,0,'update',1);
print '</td>';
print '</tr>';
// Date end subscription
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
Form::selectDate($subscription->datef,'datesubend',0,0,0,'update',1);
$form->select_date($subscription->datef,'datesubend',0,0,0,'update',1);
print '</td>';
print '</tr>';
@ -295,7 +295,7 @@ if ($rowid && $action != 'edit')
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
$text=$langs->trans("ConfirmDeleteSubscription");
if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
print Form::formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1);
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
@ -307,7 +307,7 @@ if ($rowid && $action != 'edit')
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="3">';
print Form::showrefnav($subscription, 'rowid', $linkback, 1);
print $form->showrefnav($subscription, 'rowid', $linkback, 1);
print '</td></tr>';
// Member

View File

@ -191,12 +191,12 @@ if ($result > 0)
}
else
{
$records=$ldap->getAttribute($dn,$search);
$records = $ldap->getAttribute($dn,$search);
//print_r($records);
// Affichage arbre
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{
if (! is_array($records))
{

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -28,6 +28,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.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.'/core/lib/company.lib.php';
$langs->load("members");
$langs->load("companies");
@ -43,6 +44,14 @@ $search_ref=GETPOST("search_ref");
$search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname");
$search_login=GETPOST("search_login");
$search_address=GETPOST("search_address");
$search_zip=GETPOST("search_zip");
$search_town=GETPOST("search_town");
$search_state=GETPOST("search_state");
$search_country=GETPOST("search_country");
$search_phone=GETPOST("search_phone");
$search_phone_perso=GETPOST("search_phone_perso");
$search_phone_mobile=GETPOST("search_phone_mobile");
$type=GETPOST("type");
$search_email=GETPOST("search_email");
$search_categ = GETPOST("search_categ",'int');
@ -50,6 +59,8 @@ $catid = GETPOST("catid",'int');
$sall=GETPOST("sall");
$optioncss = GETPOST('optioncss','alpha');
if ($statut < -1) $statut = '';
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -61,31 +72,22 @@ $pagenext = $page + 1;
if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search="";
$search_ref="";
$search_lastname="";
$search_firstname="";
$search_login="";
$type="";
$search_email="";
$search_categ="";
$catid="";
$sall="";
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'd.rowid'=>'Ref',
//'d.ref'=>'Ref',
'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname',
'd.societe'=>"Company",
'd.login'=>'Login',
'd.societe'=>"Company",
'd.email'=>'EMail',
'd.address'=>'Address',
'd.zip'=>'Zip',
@ -93,7 +95,79 @@ $fieldstosearchall = array(
'd.note_public'=>'NotePublic',
'd.note_private'=>'NotePrivate',
);
$arrayfields=array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1),
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'd.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'd.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0),
'd.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'd.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>0),
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
/*
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$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_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search="";
$search_ref="";
$search_lastname="";
$search_firstname="";
$search_login="";
$search_company="";
$type="";
$search_email="";
$search_address="";
$search_zip="";
$search_town="";
$search_state="";
$search_country='';
$search_phone='';
$search_phone_perso='';
$search_phone_mobile='';
$search_morphy="";
$search_categ="";
$catid="";
$sall="";
$statut='';
$search_array_options=array();
}
/*
* View
@ -109,9 +183,11 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute
$now=dol_now();
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
$sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql.= " t.libelle as type, t.cotisation,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
@ -119,7 +195,10 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
if ($catid > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($catid);
@ -129,7 +208,7 @@ if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($statut != '') $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref)
{
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
@ -138,12 +217,31 @@ if ($search_ref)
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
if ($search_login) $sql.= natural_search("d.login", $search_login);
if ($search_email) $sql.= natural_search("d.email", $search_email);
if ($search_town) $sql.= natural_search("d.town",$search_town);
if ($search_zip) $sql.= natural_search("d.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records with no order and no limits
@ -187,14 +285,35 @@ if ($resql)
}
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($statut != "") $param.="&statut=".$statut;
if ($search_nom) $param.="&search_nom=".$search_nom;
if ($search_login) $param.="&search_login=".$search_login;
if ($search_email) $param.="&search_email=".$search_email;
if ($filter) $param.="&filter=".$filter;
if ($type > 0) $param.="&type=".$type;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($statut != "") $param.="&statut=".urlencode($statut);
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname);
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
if ($search_login) $param.="&search_login=".urlencode($search_login);
if ($search_email) $param.="&search_email=".urlencode($search_email);
if ($search_company) $param.="&search_company=".urlencode($search_company);
if ($search_address != '') $param.= "&search_address=".urlencode($search_address);
if ($search_town != '') $param.= "&search_town=".urlencode($search_town);
if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone);
if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso);
if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile);
if ($filter) $param.="&filter=".urlencode($filter);
if ($type > 0) $param.="&type=".urlencode($type);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -222,96 +341,259 @@ if ($resql)
$moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
print '</div>';
}
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{
print '<td width="5" align="center">&nbsp;</td>';
print '<td colspan="1" align="center">'.$langs->trans("NumberingShort").'</td>';
}
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
$parameters=array();
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans(""),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n";
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Line for filters fields
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
// Line numbering
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{
print '<td class="liste_titre">&nbsp;</td>';
}
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
}
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" value="'.$search_ref.'" size="4"></td>';
if (! empty($arrayfields['d.firstname']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="6"></td>';
}
if (! empty($arrayfields['d.lastname']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="6"></td>';
}
if (! empty($arrayfields['d.company']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'" size="6"></td>';
}
if (! empty($arrayfields['d.login']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="6"></td>';
}
if (! empty($arrayfields['d.morphy']['checked']))
{
print '<td class="liste_titre" align="left">';
print '</td>';
}
if (! empty($arrayfields['t.libelle']['checked']))
{
print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array();
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
print '</td>';
}
if (! empty($arrayfields['d.address']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_address" value="'.$search_address.'" size="5"></td>';
}
if (! empty($arrayfields['d.zip']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_zip" value="'.$search_zip.'" size="5"></td>';
}
if (! empty($arrayfields['d.town']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_town" value="'.$search_town.'" size="5"></td>';
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
}
// Phone pro
if (! empty($arrayfields['d.phone']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_phone" value="'.$search_phone.'" size="5"></td>';
}
// Phone perso
if (! empty($arrayfields['d.phone_perso']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_phone_perso" value="'.$search_phone_perso.'" size="5"></td>';
}
// Phone mobile
if (! empty($arrayfields['d.phone_mobile']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'" size="5"></td>';
}
// Email
if (! empty($arrayfields['d.email']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="5"></td>';
}
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="12"></td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="7"></td>';
print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array();
print Form::selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
if (! empty($arrayfields['d.datefin']['checked']))
{
print '<td class="liste_titre" align="left">';
print '</td>';
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attribute_type[$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
}
print '</td>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Status
if (! empty($arrayfields['d.statut']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
$liststatus=array(
'-1'=>$langs->trans("Draft"),
'1'=>$langs->trans("Validated"),
'0'=>$langs->trans("Resiliated")
);
print $form->selectarray('statut', $liststatus, $statut, -2);
print '</td>';
}
// Action column
print '<td class="liste_titre" align="middle">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
print '<td class="liste_titre">&nbsp;</td>';
// Action column
print '<td class="liste_titre" colspan="2" align="right">';
$searchpitco=Form::showFilterAndCheckAddButtons();
print $searchpitco;
print '</td>';
print "</tr>\n";
$var=True;
while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($resql);
$obj = $db->fetch_object($resql);
$datefin=$db->jdate($objp->datefin);
$memberstatic->id=$objp->rowid;
$memberstatic->ref=$objp->rowid;
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
$memberstatic->statut=$objp->statut;
$datefin=$db->jdate($obj->datefin);
$memberstatic->id=$obj->rowid;
$memberstatic->ref=$obj->rowid;
$memberstatic->lastname=$obj->lastname;
$memberstatic->firstname=$obj->firstname;
$memberstatic->societe=$obj->company;
$memberstatic->statut=$obj->statut;
$memberstatic->datefin= $datefin;
if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();
$memberstatic->socid = $obj->fk_soc;
if (! empty($obj->fk_soc)) {
$memberstatic->fetch_thirdparty();
$companyname=$memberstatic->thirdparty->name;
} else {
$companyname=$objp->company;
$companyname=$obj->company;
}
$var=!$var;
@ -322,85 +604,212 @@ if ($resql)
print '<td align="center">'.($i+1).'</td>';
}
// Ref
print "<td>";
print $memberstatic->getNomUrl(1);
print "</td>\n";
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print "<td>";
print $memberstatic->getNomUrl(1);
print "</td>\n";
}
// Lastname
print "<td><a href=\"card.php?rowid=$objp->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 "</a></td>\n";
// Login
print "<td>".$objp->login."</td>\n";
// Type
$membertypestatic->id=$objp->type_id;
$membertypestatic->libelle=$objp->type;
print '<td class="nowrap">';
print $membertypestatic->getNomUrl(1,32);
print '</td>';
// Moral/Physique
print "<td>".$memberstatic->getmorphylib($objp->morphy)."</td>\n";
if (! empty($arrayfields['d.lastname']['checked']))
{
print "<td>";
print $obj->lastname;
print "</td>\n";
}
// Firstname
if (! empty($arrayfields['d.firstname']['checked']))
{
print "<td>";
print $obj->firstname;
print "</td>\n";
}
// Company
if (! empty($arrayfields['d.company']['checked']))
{
print "<td>";
print $companyname;
print "</td>\n";
}
// Login
if (! empty($arrayfields['d.login']['checked']))
{
print "<td>".$obj->login."</td>\n";
}
// Moral/Physique
if (! empty($arrayfields['d.morphy']['checked']))
{
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
}
// Type label
if (! empty($arrayfields['t.libelle']['checked']))
{
$membertypestatic->id=$obj->type_id;
$membertypestatic->libelle=$obj->type;
print '<td class="nowrap">';
print $membertypestatic->getNomUrl(1,32);
print '</td>';
}
// Address
if (! empty($arrayfields['d.address']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->address;
print '</td>';
}
// Zip
if (! empty($arrayfields['d.zip']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Town
if (! empty($arrayfields['d.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td align="center">';
$tmparray=getCountry($obj->country,'all');
print $tmparray['label'];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Phone pro
if (! empty($arrayfields['d.phone']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->phone;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Phone perso
if (! empty($arrayfields['d.phone_perso']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->phone_perso;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Phone mobile
if (! empty($arrayfields['d.phone_mobile']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->phone_mobile;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Statut
print '<td class="nowrap">';
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
print "</td>";
if (! empty($arrayfields['d.email']['checked']))
{
print "<td>".dol_print_email($obj->email,0,0,1)."</td>\n";
}
// End of subscription date
if ($datefin)
$datefin=$db->jdate($obj->datefin);
if (! empty($arrayfields['d.datefin']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($datefin,'day');
if ($memberstatic->hasDelay()) {
print " ".img_warning($langs->trans("SubscriptionLate"));
}
print '</td>';
if ($datefin)
{
print '<td align="center" class="nowrap">';
print dol_print_date($datefin,'day');
if ($memberstatic->hasDelay()) {
print " ".img_warning($langs->trans("SubscriptionLate"));
}
print '</td>';
}
else
{
print '<td align="left" class="nowrap">';
if ($obj->cotisation == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
}
}
else
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
print '<td align="left" class="nowrap">';
if ($objp->cotisation == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
print '<td';
$align=$extrafields->getAlignFlag($key);
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
}
}
// Actions
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['d.statut']['checked']))
{
print '<td align="right" class="nowrap">';
print $memberstatic->LibStatut($obj->statut,$obj->cotisation,$datefin,2);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td align="center">';
if ($user->rights->adherent->creer)
{
print "<a href=\"card.php?rowid=".$objp->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
print "<a href=\"card.php?rowid=".$obj->rowid."&action=edit&backtopage=1\">".img_edit()."</a>";
}
print '&nbsp;';
if ($user->rights->adherent->supprimer && $objp->statut == -1)
if ($user->rights->adherent->supprimer && $obj->statut == -1)
{
print "<a href=\"card.php?rowid=".$objp->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
print "<a href=\"card.php?rowid=".$obj->rowid."&action=delete&backtopage=1\">".img_picto($langs->trans("Delete"),'disable.png')."</a>";
}
if ($user->rights->adherent->supprimer && $objp->statut == 1)
if ($user->rights->adherent->supprimer && $obj->statut == 1)
{
print "<a href=\"card.php?rowid=".$objp->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
print "<a href=\"card.php?rowid=".$obj->rowid."&action=resign&backtopage=1\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
}
print "</td>";
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}

View File

@ -94,7 +94,7 @@ if ($id)
// Morphy
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
print Form::showphoto('memberphoto',$member);
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print '</tr>';

View File

@ -176,7 +176,7 @@ print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
print '</tr>';
$oldyear=0;
$var=false;
$var=true;
foreach ($data as $val)
{
$year = $val['year'];

View File

@ -153,6 +153,7 @@ if ($action == 'delete' && $user->rights->adherent->configurer)
exit;
}
/*
* View
*/
@ -200,7 +201,10 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<td>'.dol_escape_htmltag($objp->libelle).'</td>';
print '<td align="center">'.yn($objp->cotisation).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
if ($user->rights->adherent->configurer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
else
print '<td align="right">&nbsp;</td>';
print "</tr>";
$i++;
}
@ -233,18 +237,18 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<tbody>';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print Form::selectyesno("cotisation",1,1);
print $form->selectyesno("cotisation",1,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print Form::selectyesno("vote",0,1);
print $form->selectyesno("vote",0,1);
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" cols="60" rows="3"></textarea></td></tr>';
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -297,7 +301,7 @@ if ($rowid > 0)
// Ref
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
print '<td>';
print Form::showrefnav($object, 'rowid', $linkback);
print $form->showrefnav($object, 'rowid', $linkback);
print '</td></tr>';
// Label
@ -634,15 +638,15 @@ if ($rowid > 0)
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.dol_escape_htmltag($object->libelle).'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print Form::selectyesno("cotisation",$object->cotisation,1);
print $form->selectyesno("cotisation",$object->cotisation,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print Form::selectyesno("vote",$object->vote,1);
print $form->selectyesno("vote",$object->vote,1);
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$object->note.'</textarea></td></tr>';
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';

View File

@ -195,7 +195,7 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Name")."</td>";
print "<td>".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)</td>';
print "<td>".Form::textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).'</td>';
print "<td>".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).'</td>';
print '<td align="right">'.$langs->trans("Color").'</td>';
print "</tr>";

View File

@ -164,7 +164,7 @@ print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print Form::selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n";
print '</table>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -46,24 +46,6 @@ $action = GETPOST('action','alpha');
* Actions
*/
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
{
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
//Order display of bank account
if ($action == 'setbankorder')
{
@ -89,58 +71,13 @@ $form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
$head = bank_admin_prepare_head(null);
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td align="center" width="60">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=true;
$var=! $var;
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
print $doleditor->Create();
}
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table>';
print "<br>";
/*
$var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_BANK_CHEQUERECEIPT_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftChequeReceipt").'<br>';
print '<input size="50" class="flat" type="text" name="BANK_CHEQUERECEIPT_DRAFT_WATERMARK" value="'.$conf->global->BANK_CHEQUERECEIPT_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
*/
//Show bank account order
print load_fiche_titre($langs->trans("BankOrderShow"));
@ -155,10 +92,10 @@ print "</tr>\n";
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
$bankorder[0][2]='BankCode DeskCode AccountNumber BankAccountNumberKey';
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
$bankorder[1][0]=$langs->trans("BankOrderES");
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey AccountNumber';
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
$var = true;
$i=0;
@ -202,8 +139,6 @@ print '</table>'."\n";
dol_fiche_end();
print '</form>';
llxFooter();
$db->close();

View File

@ -62,21 +62,12 @@ if ($action == 'setcoder')
}
else if ($action == 'update')
{
if (GETPOST('submit_GENBARCODE_LOCATION'))
{
$location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
}
if (GETPOST('submit_PRODUIT_DEFAULT_BARCODE_TYPE'))
{
$coder_id = GETPOST('PRODUIT_DEFAULT_BARCODE_TYPE','alpha');
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
}
if (GETPOST('submit_GENBARCODE_BARCODETYPE_THIRDPARTY'))
{
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
}
$location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
$coder_id = GETPOST('PRODUIT_DEFAULT_BARCODE_TYPE','alpha');
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
}
else if ($action == 'updateengine')
{
@ -195,9 +186,9 @@ $var=true;
print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -261,7 +252,7 @@ if ($resql)
// Build barcode on disk (not used, this is done to make debug easier)
$result=$module->writeBarCode($obj->example,$obj->encoding,'Y');
// Generate on the fly and output barcode with generator
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding);
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&amp;generator='.urlencode($obj->coder).'&amp;code='.urlencode($obj->example).'&amp;encoding='.urlencode($obj->encoding);
//print $url;
print '<img src="'.$url.'" title="'.$obj->example.'" border="0">';
}
@ -296,7 +287,7 @@ if (empty($conf->use_javascript_ajax))
// TODO Implement code behind action updateengine
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
}
print '</form>';
//print '</form>';
print "<br>";
@ -331,9 +322,7 @@ if (! isset($_SERVER['WINDIR']))
$langs->load("errors");
print '<br><font class="error">'.$langs->trans("ErrorFileNotFound",$conf->global->GENBARCODE_LOCATION).'</font>';
}
print '</td>';
print '<td width="60" align="center"><input type="submit" class="button" name="submit_GENBARCODE_LOCATION" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</td></tr>';
}
// Module products
@ -344,10 +333,7 @@ if (! empty($conf->product->enabled))
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
print '<td width="60" align="right">';
$formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1);
print '</td><td align="right">';
print '<input type="submit" class="button" name="submit_PRODUIT_DEFAULT_BARCODE_TYPE" value="'.$langs->trans("Modify").'">';
print "</td>";
print '</tr>';
print '</td></tr>';
}
// Module thirdparty
@ -358,13 +344,13 @@ if (! empty($conf->societe->enabled))
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
print '<td width="60" align="right">';
print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"GENBARCODE_BARCODETYPE_THIRDPARTY",1);
print '</td><td align="right">';
print '<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans("Modify").'">';
print "</td>";
print '</tr>';
print '</td></tr>';
}
print "</table>\n";
print '<div class="tabsAction">';
print '<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans("Modify").'">';
print "</div>";
print '</form>';
print '<br>';
@ -419,19 +405,19 @@ if ($conf->produit->enabled)
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file")
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&value='.$file.'">';
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;value='.$file.'">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a></td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&value='.$file.'">';
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print '<td align="center">';
$s=$modBarCode->getToolTip($langs,null,-1);
print Form::textwithpicto('',$s,1);
print $form->textwithpicto('',$s,1);
print '</td>';
print "</tr>\n";
}
@ -442,7 +428,7 @@ if ($conf->produit->enabled)
print "</table>\n";
}
print '</form>';
//print '</form>';
print "<br>";

View File

@ -367,7 +367,7 @@ foreach($boxtoadd as $box)
// Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position
print '<td class="center">';
print Form::selectarray("boxid[".$box->box_id."][pos]", $pos_name, 0, 1, 0, 0, '', 1)."\n";
print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, 0, 1, 0, 0, '', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';
@ -472,7 +472,7 @@ print '</tr>';
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print Form::selectyesno('MAIN_ACTIVATE_FILECACHE',$conf->global->MAIN_ACTIVATE_FILECACHE,1);
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE',$conf->global->MAIN_ACTIVATE_FILECACHE,1);
print '</td>';
print '</tr>';
}

View File

@ -0,0 +1,287 @@
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/bank.php
* \ingroup bank
* \brief Page to setup the bank module
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
$langs->load("admin");
$langs->load("companies");
$langs->load("bills");
$langs->load("other");
$langs->load("banks");
if (!$user->admin)
accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php';
/*
* Actions
*/
if ($action == 'updateMask')
{
$maskconstchequereceipts=GETPOST('maskconstchequereceipts','alpha');
$maskchequereceipts=GETPOST('maskchequereceipts','alpha');
if ($maskconstchequereceipts) $res = dolibarr_set_const($db,$maskconstchequereceipts,$maskchequereceipts,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if ($action == 'setmod')
{
dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON",$value,'chaine',0,'',$conf->entity);
}
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
{
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* view
*/
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader("",$langs->trans("BankSetupModule"));
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
$head = bank_admin_prepare_head(null);
dol_fiche_head($head, 'checkreceipts', $langs->trans("BankSetupModule"), 0, 'account');
/*
* Numbering module
*/
print load_fiche_titre($langs->trans("ChequeReceiptsNumberingModule"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/cheque/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
{
$filebis = $file;
$name = substr($file, 4, dol_strlen($file) -16);
$classname = preg_replace('/\.php$/','',$file);
// For compatibility
if (! is_file($dir.$filebis))
{
$filebis = $file."/".$file.".modules.php";
$classname = "mod_chequereceipt_".$file;
}
// Check if there is a filter on country
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
$classname = preg_replace('/\-.*$/','',$classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{
// Charging the numbering class
require_once $dir.$filebis;
$module = new $classname($db);
// 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;
if ($module->isEnabled())
{
$var = !$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering module
print '<td class="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file)
{
print img_picto($langs->trans("Activated"),'switch_on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
print '</td>';
$chequereceipts=new RemiseCheque($db);
$chequereceipts->initAsSpecimen();
// Example
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$chequereceipts);
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.'<br>';
} else {
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{
if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1);
}
print '</td>';
print "</tr>\n";
}
}
}
}
closedir($handle);
}
}
}
print '</table>';
print '<br>';
/*
* Other options
*
*/
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td align="center" width="60">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=true;
$var=! $var;
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
print $doleditor->Create();
}
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table>';
print "<br>";
print '</table>'."\n";
dol_fiche_end();
print '</form>';
llxFooter();
$db->close();

View File

@ -83,7 +83,7 @@ print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ClickToDialUseTelLink").'</td><td>';
print Form::selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
print '<br>';
print $langs->trans("ClickToDialUseTelLinkDesc");
print '</td></tr>';

View File

@ -376,7 +376,7 @@ foreach ($dirmodels as $reldir)
}
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print "</tr>\n";
@ -524,7 +524,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview

View File

@ -98,12 +98,14 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
// Create thumbs of logo (Note that PDF use original file and not thumbs)
if ($isimage > 0)
{
// Create small thumbs for company (Ratio is near 16/9)
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
// Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
{
$imgThumbSmall = $reg[1];
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbSmall);
@ -111,9 +113,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
{
$imgThumbMini = $reg[1];
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbMini);
@ -203,12 +205,14 @@ if ($action == 'addthumb')
// Create thumbs of logo
if ($isimage > 0)
{
// Create small thumbs for company (Ratio is near 16/9)
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
// Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
{
$imgThumbSmall = $reg[1];
$imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbSmall);
@ -218,7 +222,7 @@ if ($action == 'addthumb')
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
{
$imgThumbMini = $reg[1];
$imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
}
else dol_syslog($imgThumbMini);
@ -608,7 +612,7 @@ if ($action == 'edit' || $action == 'updateedit')
$opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
print Form::selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
print '</td></tr>';
print "</table>";
print "</td></tr>\n";
@ -650,7 +654,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '</td></tr>';
}
print '<tr><td align="left"><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
print Form::selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
print '</td></tr>';
print "</table>";
print "</td></tr>\n";
@ -727,7 +731,9 @@ else
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>';
print currency_name($conf->currency,1);
print ' ('.$langs->getCurrencySymbol($conf->currency).')';
print ' ('.$conf->currency;
print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : '');
print ')';
print '</td></tr>';
$var=!$var;
@ -914,7 +920,7 @@ else
print '</script>';
print "\n";
$s.='<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
$s = Form::textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
$s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
}
else
{

View File

@ -131,7 +131,10 @@ print '</tr>';
// Bon de livraison activation/desactivation
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("DeliveriesOrderAbility").'</td>';
print '<td>';
print $langs->trans("DeliveriesOrderAbility");
print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
print '</td>';
print '<td align="center" width="20">';
print '</td>';
print '<td align="center" width="100">';
@ -151,7 +154,5 @@ print '</table>';
print '</div>';
print info_admin($langs->trans("NoNeedForDeliveryReceipts"));
llxFooter();
$db->close();

View File

@ -311,7 +311,7 @@ foreach ($dirmodels as $reldir)
}
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -457,7 +457,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview

View File

@ -184,7 +184,7 @@ if ($action == 'edit')
$var=false;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .Form::selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
print '</table>';

View File

@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
@ -46,6 +46,8 @@ $langs->load("admin");
$langs->load("companies");
$langs->load("resource");
$langs->load("holiday");
$langs->load("accountancy");
$langs->load("hrm");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
@ -78,7 +80,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,27,0,5,11,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0);
// Name of SQL tables of dictionaries
$tabname=array();
@ -112,6 +114,10 @@ $tabname[27]= MAIN_DB_PREFIX."c_stcomm";
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
$tabname[29]= MAIN_DB_PREFIX."c_lead_status";
$tabname[30]= MAIN_DB_PREFIX."c_format_cards";
$tabname[31]= MAIN_DB_PREFIX."accounting_system";
$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
// Dictionary labels
$tablib=array();
@ -145,6 +151,10 @@ $tablib[27]= "DictionaryProspectStatus";
$tablib[28]= "DictionaryHolidayTypes";
$tablib[29]= "DictionaryOpportunityStatus";
$tablib[30]= "DictionaryFormatCards";
$tablib[31]= "DictionaryAccountancysystem";
$tablib[32]= "DictionaryAccountancyCategory";
$tablib[33]= "DictionaryDepartment";
$tablib[34]= "DictionaryFunction";
// Requests to extract data
$tabsql=array();
@ -172,12 +182,16 @@ $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 as 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";
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
// Criteria to sort dictionaries
$tabsqlsort=array();
@ -211,6 +225,10 @@ $tabsqlsort[27]="code ASC";
$tabsqlsort[28]="country ASC, code ASC";
$tabsqlsort[29]="position ASC";
$tabsqlsort[30]="code ASC";
$tabsqlsort[31]="pcg_version ASC";
$tabsqlsort[32]="position ASC";
$tabsqlsort[33]="code ASC";
$tabsqlsort[34]="code ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@ -238,12 +256,16 @@ $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,position,topic,content";
$tabfield[25]= "label,type_template,private,position,topic,content";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
$tabfield[29]= "code,label,percent,position";
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
$tabfield[31]= "pcg_version,label";
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
$tabfield[33]= "code,label";
$tabfield[34]= "code,label";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@ -271,12 +293,16 @@ $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,position,topic,content";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
$tabfieldvalue[29]= "code,label,percent,position";
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
$tabfieldvalue[31]= "pcg_version,label";
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
$tabfieldvalue[33]= "code,label";
$tabfieldvalue[34]= "code,label";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -304,12 +330,16 @@ $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,position,topic,content";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content,entity";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
$tabfieldinsert[29]= "code,label,percent,position";
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
$tabfieldinsert[31]= "pcg_version,label";
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[33]= "code,label";
$tabfieldinsert[34]= "code,label";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@ -345,6 +375,10 @@ $tabrowid[27]= "id";
$tabrowid[28]= "";
$tabrowid[29]= "";
$tabrowid[30]= "";
$tabrowid[31]= "";
$tabrowid[32]= "";
$tabrowid[33]= "rowid";
$tabrowid[34]= "rowid";
// Condition to show dictionary in setup page
$tabcond=array();
@ -378,6 +412,10 @@ $tabcond[27]= ! empty($conf->societe->enabled);
$tabcond[28]= ! empty($conf->holiday->enabled);
$tabcond[29]= ! empty($conf->projet->enabled);
$tabcond[30]= ! empty($conf->label->enabled);
$tabcond[31]= ! empty($conf->accounting->enabled);
$tabcond[32]= ! empty($conf->accounting->enabled);
$tabcond[33]= ! empty($conf->hrm->enabled);
$tabcond[34]= ! empty($conf->hrm->enabled);
// List of help for fields
$tabhelp=array();
@ -411,6 +449,10 @@ $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@ -444,6 +486,10 @@ $tabfieldcheck[27] = array();
$tabfieldcheck[28] = array();
$tabfieldcheck[29] = array();
$tabfieldcheck[30] = array();
$tabfieldcheck[31] = array();
$tabfieldcheck[32] = array();
$tabfieldcheck[33] = array();
$tabfieldcheck[34] = 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);
@ -478,6 +524,7 @@ if ($id == 11)
'propal' => $langs->trans('Proposal'),
'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'),
'resource' => $langs->trans('Resource'),
// 'facture_fourn' => $langs->trans('SupplierBill'),
'fichinter' => $langs->trans('InterventionCard')
);
@ -504,6 +551,14 @@ if ($id == 25)
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
foreach ($hookmanager->resArray as $item => $value) {
$elementList[$item] = $value;
}
}
}
// Define localtax_typeList (used for dictionary "llx_c_tva")
@ -534,11 +589,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue;
if ($value == 'formula' && empty($_POST['formula'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
)
@ -559,6 +615,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
@ -598,7 +655,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
}
// Clean some parameters
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
@ -850,7 +907,7 @@ print "<br>\n";
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print Form::formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
}
//var_dump($elementList);
@ -920,7 +977,7 @@ if ($id)
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=Form::textwithtooltip($langs->trans("Type"),$langs->trans("TypePaymentDesc"),2,1,img_help(1,''));
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"),$langs->trans("TypePaymentDesc"),2,1,img_help(1,''));
else $valuetoshow=$langs->trans("Type");
}
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
@ -952,6 +1009,10 @@ if ($id)
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
if ($id == 2) // Special cas for state page
{
@ -963,7 +1024,7 @@ if ($id)
{
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
else if (! empty($tabhelp[$id][$value])) print Form::textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
}
@ -1017,7 +1078,7 @@ if ($id)
}
print '</td>';
print "</tr>";
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
@ -1119,6 +1180,10 @@ if ($id)
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
// Affiche nom du champ
if ($showfield)
@ -1200,7 +1265,7 @@ if ($id)
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
}
}
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
$valuetoshow=yn($valuetoshow);
$align="center";
}
@ -1341,8 +1406,10 @@ if ($id)
$valuetoshow = length_accountg($valuetoshow);
}
$class='tddict';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
// Show value for field
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
}
}
@ -1359,7 +1426,7 @@ if ($id)
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
$canbemodified=$iserasable;
if ($obj->code == 'RECEP') $canbemodified=1;
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?urlencode($obj->code):'').'&amp;id='.$id.'&amp;';
// Favorite
@ -1494,7 +1561,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db);
foreach ($fieldlist as $field => $value)
{
@ -1545,21 +1612,21 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print Form::selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// Le type de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'element')
{
print '<td>';
print Form::selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// La source de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'source')
{
print '<td>';
print Form::selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
@ -1568,9 +1635,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print 'user<input type="hidden" name="type" value="user">';
print '</td>';
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
print '<td>';
print Form::selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
print '</td>';
}
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
@ -1615,14 +1682,14 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
'point' => $langs->trans('SizeUnitpoint'),
'inch' => $langs->trans('SizeUnitinch')
);
print Form::selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
print '</td>';
}
// Le type de taxe locale
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
{
print '<td align="center">';
print Form::selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
@ -1642,13 +1709,13 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
else
{
print '<td>';
$size='';
$size=''; $class='';
if ($fieldlist[$field]=='code') $size='size="8" ';
if ($fieldlist[$field]=='position') $size='size="4" ';
if ($fieldlist[$field]=='libelle') $size='size="32" ';
if ($fieldlist[$field]=='tracking') $size='size="92" ';
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
if ($fieldlist[$field]=='libelle') $size='centpercent';
if ($fieldlist[$field]=='tracking') $class='centpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}
}

View File

@ -316,7 +316,7 @@ foreach ($dirmodels as $reldir)
}
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -463,7 +463,7 @@ foreach ($dirmodels as $reldir)
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview

View File

@ -327,7 +327,7 @@ foreach ($dirmodels as $reldir)
}
}
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -469,7 +469,7 @@ foreach ($dirmodels as $reldir)
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,-1,0);
print $form->textwithpicto('',$htmltooltip,-1,0);
print '</td>';
// Preview

View File

@ -262,11 +262,11 @@ if ($action == 'setforcedate')
}
}
if ($action == 'set_FAC_AUTO_FILLJS')
if ($action == 'set_INVOICE_AUTO_FILLJS')
{
$freetext = GETPOST('FAC_AUTO_FILLJS'); // No alpha here, we want exact string
$freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FAC_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@ -444,7 +444,7 @@ foreach ($dirmodels as $reldir)
}
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{
@ -566,7 +566,7 @@ foreach ($dirmodels as $reldir)
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"),'switch_off').'</a>';
print "</td>";
}
@ -578,7 +578,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"),'off').'</a>';
}
print '</td>';
@ -600,7 +600,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview
@ -744,7 +744,7 @@ print '<input type="hidden" name="action" value="setforcedate" />';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ForceInvoiceDate");
print '</td><td width="60" align="center">';
print Form::selectyesno("forcedate",$conf->global->FAC_FORCE_DATE_VALIDATION,1);
print $form->selectyesno("forcedate",$conf->global->FAC_FORCE_DATE_VALIDATION,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
@ -754,11 +754,11 @@ print '</form>';
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
print '<input type="hidden" name="action" value="set_INVOICE_AUTO_FILLJS" />';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("JSOnPaimentBill");
print '</td><td width="60" align="center">';
print Form::selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";

View File

@ -189,7 +189,19 @@ else
show_skin(null,1);
print '<br>'."\n";
print load_fiche_titre($langs->trans("TestSubmitForm"),'(mode='.$mode.')','');
$listofmodes=array('dolibarr_mailings','dolibarr_notes','dolibarr_details','Full');
$linkstomode='';
foreach($listofmodes as $newmode)
{
if ($linkstomode) $linkstomode.=' - ';
$linkstomode.='<a href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
if ($mode == $newmode) $linkstomode.='<strong>';
$linkstomode.=$newmode;
if ($mode == $newmode) $linkstomode.='</strong>';
$linkstomode.='</a>';
}
$linkstomode.='';
print load_fiche_titre($langs->trans("TestSubmitForm"),$linkstomode,'');
print '<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).'">';
$uselocalbrowser=true;
$readonly=($mode=='dolibarr_readonly'?1:0);

View File

@ -338,7 +338,7 @@ foreach ($dirmodels as $reldir)
}
}
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,1,0);
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
@ -479,7 +479,7 @@ foreach ($dirmodels as $reldir)
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print Form::textwithpicto('',$htmltooltip,-1,0);
print $form->textwithpicto('',$htmltooltip,-1,0);
print '</td>';
// Preview

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