Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop
This commit is contained in:
commit
2d8119b17b
@ -15,3 +15,5 @@ indent_style = tab
|
|||||||
indent_style = tab
|
indent_style = tab
|
||||||
[*.xml]
|
[*.xml]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|||||||
@ -285,7 +285,7 @@ script:
|
|||||||
php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.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 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 upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
||||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||||
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||||
cd -
|
cd -
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
168
ChangeLog
168
ChangeLog
@ -15,8 +15,134 @@ make a Dolibarr upgrade.
|
|||||||
***** ChangeLog for 4.0 compared to 3.9.* *****
|
***** ChangeLog for 4.0 compared to 3.9.* *****
|
||||||
For users:
|
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:
|
For developers:
|
||||||
|
|
||||||
|
NEW: Add a css class style called 'reposition', so when clicking on a link with this class will move scrollbarr to be placed at same page location.
|
||||||
|
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:
|
WARNING:
|
||||||
|
|
||||||
@ -35,6 +161,48 @@ So if you included it into your module, change your code like this to be compati
|
|||||||
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 3.9.2 compared to 3.9.1 *****
|
||||||
|
FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN
|
||||||
|
FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists
|
||||||
|
FIX: #5236 Cron module activated but "Modules tools" does not appear in the left menu.
|
||||||
|
FIX: Accountancy - 3.9 - Chart of accounts are limited on only one country
|
||||||
|
FIX: bug on email template
|
||||||
|
FIX: Can't create a stock transfer from product card
|
||||||
|
FIX: can't fetch by siret or siren because of first "if"
|
||||||
|
FIX: Check stock of product by warehouse if $entrepot_id defined on shippings
|
||||||
|
FIX: Compatible with multicompany
|
||||||
|
FIX: Creation of the second ressource type fails.
|
||||||
|
FIX: end of select when no fournprice
|
||||||
|
FIX: Filter on assigned to was preselected on current user on list "All events" (instead of no filtering)
|
||||||
|
FIX: Filter on category tag for suppliers
|
||||||
|
FIX: hook on group card called but not initialized
|
||||||
|
FIX: Infinite loop on menu tree output for edition
|
||||||
|
FIX: Can show tree of entries added by external modules using fk_mainmenu and fk_leftmenu instead of fk_menu.
|
||||||
|
FIX: init var at wrong place report incorrect "shippable" flag on draft order.
|
||||||
|
FIX: It doesn't check if there is enough stock to update the lines of orders/invoices
|
||||||
|
FIX: Menu statistics was not visible if module proposal was not enabled
|
||||||
|
FIX: Merge manually PR #5161 - Bad translation key
|
||||||
|
FIX: missing column when module was installed before standard integration
|
||||||
|
FIX: Missing number total of modules
|
||||||
|
FIX: Not filtering correctly when coming from dashboard
|
||||||
|
FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH
|
||||||
|
FIX: Remove PHP Warning: Creating default object from empty value.
|
||||||
|
FIX: same page added several times on mergepropal option
|
||||||
|
FIX: search on date into supplier invoice list dont work because of status -1
|
||||||
|
FIX: Search supplier ref on contract
|
||||||
|
FIX: Split of credit note into discount page generates records not correctly recognised as credit note.
|
||||||
|
FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty
|
||||||
|
FIX: #5087
|
||||||
|
FIX: #5108
|
||||||
|
FIX: #5163
|
||||||
|
FIX: #5195
|
||||||
|
FIX: #5203
|
||||||
|
FIX: #5207
|
||||||
|
FIX: #5209
|
||||||
|
FIX: #5230
|
||||||
|
|
||||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||||
FIX: #3815 Call to undefined function local_by_date()
|
FIX: #3815 Call to undefined function local_by_date()
|
||||||
FIX: #4424 Missing email of user popup in supplier orders area
|
FIX: #4424 Missing email of user popup in supplier orders area
|
||||||
|
|||||||
@ -151,7 +151,7 @@ Administrator, user, developer and translator's documentations are available alo
|
|||||||
|
|
||||||
## CONTRIBUTING
|
## 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
|
## CREDITS
|
||||||
|
|
||||||
|
|||||||
@ -6,3 +6,16 @@ Require all denied
|
|||||||
Order deny, allow
|
Order deny, allow
|
||||||
Denied from all
|
Denied from all
|
||||||
</IfVersion>
|
</IfVersion>
|
||||||
|
|
||||||
|
|
||||||
|
# OPTIMIZE: To use cache on static pages (A259200 = 1 month, A7200 = 2 hours, A691600 = 8 days = recommanded for static resources).
|
||||||
|
# Note that you must also enable the module mod_expires.
|
||||||
|
#ExpiresActive On
|
||||||
|
#ExpiresByType image/x-icon A2592000
|
||||||
|
#ExpiresByType image/gif A2592000
|
||||||
|
#ExpiresByType image/png A2592000
|
||||||
|
#ExpiresByType image/jpeg A2592000
|
||||||
|
#ExpiresByType text/css A2592000
|
||||||
|
#ExpiresByType text/javascript A2592000
|
||||||
|
#ExpiresByType application/x-javascript A2592000
|
||||||
|
#ExpiresByType application/javascript A2592000
|
||||||
|
|||||||
@ -745,7 +745,7 @@ SSLCertificateKeyFile "WAMPROOT/myserver.key"
|
|||||||
# You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set.
|
# You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set.
|
||||||
#TODO
|
#TODO
|
||||||
|
|
||||||
# OPTIMIZE: To use cache on static pages (A259200 = 1 month).
|
# OPTIMIZE: To use cache on static pages (A259200 = 1 month, A7200 = 2 hours, A691600 = 8 days = recommanded for static resources).
|
||||||
# Note that you must also enable the module mod_expires.
|
# Note that you must also enable the module mod_expires.
|
||||||
#ExpiresActive On
|
#ExpiresActive On
|
||||||
#ExpiresByType image/x-icon A2592000
|
#ExpiresByType image/x-icon A2592000
|
||||||
|
|||||||
@ -9,7 +9,8 @@ beta version of Dolibarr, step by step.
|
|||||||
|
|
||||||
- Check all files are commited.
|
- Check all files are commited.
|
||||||
- Update version/info in ChangeLog.
|
- 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"
|
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
|
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
||||||
- Commit all changes.
|
- Commit all changes.
|
||||||
@ -31,7 +32,8 @@ complete release of Dolibarr, step by step.
|
|||||||
|
|
||||||
- Check all files are commited.
|
- Check all files are commited.
|
||||||
- Update version/info in ChangeLog.
|
- 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"
|
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
|
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
||||||
- Commit all changes.
|
- Commit all changes.
|
||||||
|
|||||||
@ -17,14 +17,14 @@ fi
|
|||||||
# To detec
|
# To detec
|
||||||
if [ "x$1" = "xlist" ]
|
if [ "x$1" = "xlist" ]
|
||||||
then
|
then
|
||||||
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 "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 "*.sql" -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
|
# 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 "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# To convert
|
# To convert
|
||||||
if [ "x$1" = "xfix" ]
|
if [ "x$1" = "xfix" ]
|
||||||
then
|
then
|
||||||
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 }' `
|
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 "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||||
do
|
do
|
||||||
echo "Fix file $fic"
|
echo "Fix file $fic"
|
||||||
dos2unix "$fic"
|
dos2unix "$fic"
|
||||||
|
|||||||
@ -85,7 +85,7 @@ if ($web)
|
|||||||
echo "<body>";
|
echo "<body>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used.\n";
|
echo "If you call this with argument \"unused=true\" it searches for the translation strings that exist in en_US but are never used.\n";
|
||||||
if ($web) print "<br>";
|
if ($web) print "<br>";
|
||||||
echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.\n";
|
echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.\n";
|
||||||
if ($web) print "<br>";
|
if ($web) print "<br>";
|
||||||
@ -96,7 +96,8 @@ if ($web) print "<br>";
|
|||||||
|
|
||||||
|
|
||||||
// directory containing the php and lang files
|
// directory containing the php and lang files
|
||||||
$htdocs = $path."/../../htdocs/";
|
$htdocs = $path."../../htdocs/";
|
||||||
|
$scripts = $path."../../scripts/";
|
||||||
|
|
||||||
// directory containing the english lang files
|
// directory containing the english lang files
|
||||||
$workdir = $htdocs."langs/en_US/";
|
$workdir = $htdocs."langs/en_US/";
|
||||||
@ -109,8 +110,14 @@ if (empty($files))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dups=array();
|
||||||
$exludefiles = array('.','..','README');
|
$exludefiles = array('.','..','README');
|
||||||
$files = array_diff($files,$exludefiles);
|
$files = array_diff($files,$exludefiles);
|
||||||
|
// To force a file: $files=array('myfile.lang');
|
||||||
|
if (isset($argv[2]))
|
||||||
|
{
|
||||||
|
$files = array($argv[2]);
|
||||||
|
}
|
||||||
$langstrings_3d = array();
|
$langstrings_3d = array();
|
||||||
$langstrings_full = array();
|
$langstrings_full = array();
|
||||||
foreach ($files AS $file) {
|
foreach ($files AS $file) {
|
||||||
@ -127,7 +134,7 @@ foreach ($files AS $file) {
|
|||||||
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
|
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
|
||||||
$langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1];
|
$langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1];
|
||||||
$langstrings_full[]=$row_array[0];
|
$langstrings_full[]=$row_array[0];
|
||||||
$langstrings_dist[$row_array[0]]=$row_array[0];
|
$langstrings_dist[$row_array[0]]=$row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,26 +248,115 @@ if ($web)
|
|||||||
|
|
||||||
// STEP 2 - Search key not used
|
// STEP 2 - Search key not used
|
||||||
|
|
||||||
|
if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true'))
|
||||||
|
{
|
||||||
|
print "***** Strings in en_US that are never used:\n";
|
||||||
|
|
||||||
if (! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true')
|
$unused=array();
|
||||||
|
foreach ($langstrings_dist AS $value => $line)
|
||||||
{
|
{
|
||||||
foreach ($langstrings_dist AS $value)
|
$qualifiedforclean=1;
|
||||||
|
// Check if we must keep this key to be into file for removal
|
||||||
|
if (preg_match('/^Module\d+/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Permission\d+/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^PermissionAdvanced\d+/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^ProfId\d+/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Delays_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^BarcodeDesc/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Extrafield/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^LocalTax/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Country/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Civility/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Currency/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^DemandReasonTypeSRC/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^PaperFormat/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^AmountLT/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^TotalLT/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Month/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^MonthShort/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Day\d/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Short/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^ExportDataset_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^ImportDataset_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^ActionAC_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^TypeLocaltax/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^StatusProspect/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^PL_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^TE_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
|
||||||
|
// main.lang
|
||||||
|
if (preg_match('/^Duration/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^.b$/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0;
|
||||||
|
// orders
|
||||||
|
if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
|
||||||
|
// other.lang
|
||||||
|
if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^WeightUnit/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^LengthUnit/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^SurfaceUnit/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^VolumeUnit/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^SizeUnit/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/^EMailText/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/ById$/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/ByLogin$/', $value)) $qualifiedforclean=0;
|
||||||
|
// products
|
||||||
|
if (preg_match('/GlobalVariableUpdaterType$/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
|
||||||
|
|
||||||
|
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0;
|
||||||
|
|
||||||
|
if (! $qualifiedforclean)
|
||||||
{
|
{
|
||||||
$search = '\'trans("'.$value.'")\'';
|
continue;
|
||||||
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'*';
|
}
|
||||||
|
|
||||||
|
//$search = '\'trans("'.$value.'")\'';
|
||||||
|
$search = '-e "\''.$value.'\'" -e \'"'.$value.'"\' -e "('.$value.')"';
|
||||||
|
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'* '.$scripts.'*';
|
||||||
|
//print $string."<br>\n";
|
||||||
exec($string,$output);
|
exec($string,$output);
|
||||||
if (empty($output)) {
|
if (empty($output)) {
|
||||||
$unused[$value] = true;
|
$unused[$value] = $line;
|
||||||
echo $value.'<br>';
|
echo $line; // $trad contains the \n
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unset($output);
|
||||||
|
//print 'X'.$output.'Y';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($web) print "<h2>\n";
|
if (empty($unused)) print "No string not used found.\n";
|
||||||
print "Strings in en_US that are never used\n";
|
else
|
||||||
if ($web) print "</h2>\n";
|
{
|
||||||
if ($web) echo "<pre>";
|
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||||
print_r($unused);
|
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||||
if ($web) echo "</pre>\n";
|
file_put_contents($filetosave, join("",$unused));
|
||||||
|
print "To remove from original file, run command :\n";
|
||||||
|
if (($argv[2]?$argv[2]:"")) print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
|
||||||
|
print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:"");
|
||||||
|
if (($argv[2]?$argv[2]:"")) print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if ($action == 'display' || $action == 'delete') {
|
|||||||
if(!empty($obj)){
|
if(!empty($obj)){
|
||||||
foreach ( $obj as $cpt ) {
|
foreach ( $obj as $cpt ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
||||||
print '<td>' . $cpt->label . '</td>';
|
print '<td>' . $cpt->label . '</td>';
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j);
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
/* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,12 +42,15 @@ if (! $sortorder) $sortorder="ASC";
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
|
|
||||||
if (! $user->admin)
|
// Security check
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
accessforbidden();
|
||||||
|
if (! $user->rights->accounting->fiscalyear)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// List of statut
|
// List of status
|
||||||
static $tmpstatut2label = array (
|
static $tmpstatut2label = array (
|
||||||
'0' => 'OpenFiscalYear',
|
'0' => 'OpenFiscalYear',
|
||||||
'1' => 'CloseFiscalYear'
|
'1' => 'CloseFiscalYear'
|
||||||
@ -132,7 +135,7 @@ if ($result) {
|
|||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr ' . $bc[$var] . '><td colspan="5">' . $langs->trans("None") . '</td></tr>';
|
print '<tr ' . $bc[$var] . '><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if ($result) {
|
|||||||
while ( $i < min($num_lines, $limit) ) {
|
while ( $i < min($num_lines, $limit) ) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print $objp->accounting;
|
print $objp->accounting;
|
||||||
|
|||||||
@ -328,10 +328,10 @@ if ($result) {
|
|||||||
|
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
// Ref produit as link
|
// Ref produit as link
|
||||||
$product_static->ref = $obj->ref;
|
$product_static->ref = $obj->ref;
|
||||||
$product_static->id = $obj->rowid;
|
$product_static->id = $obj->rowid;
|
||||||
|
|||||||
@ -223,7 +223,7 @@ else {
|
|||||||
if(empty($description)){
|
if(empty($description)){
|
||||||
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
|
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
|
||||||
}
|
}
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . $description . '</td>';
|
print '<td>' . $description . '</td>';
|
||||||
|
|||||||
@ -346,7 +346,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
foreach ( $book->linesmvt as $line ) {
|
foreach ( $book->linesmvt as $line ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -400,7 +400,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($action == "" || $action == 'add') {
|
if ($action == "" || $action == 'add') {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -368,7 +368,7 @@ foreach ( $object->lines as $line ) {
|
|||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
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 align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
|
|||||||
@ -269,7 +269,7 @@ $var = True;
|
|||||||
foreach ( $object->lines as $line ) {
|
foreach ( $object->lines as $line ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
print '<td>' . $line->piece_num . '</td>' . "\n";
|
print '<td>' . $line->piece_num . '</td>' . "\n";
|
||||||
print '<td>' . $line->doc_type . '</td>' . "\n";
|
print '<td>' . $line->doc_type . '</td>' . "\n";
|
||||||
print '<td>' . dol_print_date($line->doc_date) . '</td>';
|
print '<td>' . dol_print_date($line->doc_date) . '</td>';
|
||||||
|
|||||||
@ -184,6 +184,8 @@ print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
|
|||||||
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
|
|
||||||
|
//TODO : Cannot work with PGSQL !, Change that with php treatment rather than big SQL query
|
||||||
$sql = "SELECT IF(aa.account_number IS NULL, 'Non pointe', aa.account_number) AS 'code comptable',";
|
$sql = "SELECT IF(aa.account_number IS NULL, 'Non pointe', aa.account_number) AS 'code comptable',";
|
||||||
$sql .= " IF(aa.label IS NULL, 'Non pointe', aa.label) AS 'Intitulé',";
|
$sql .= " IF(aa.label IS NULL, 'Non pointe', aa.label) AS 'Intitulé',";
|
||||||
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',";
|
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',";
|
||||||
|
|||||||
@ -288,7 +288,7 @@ if ($result) {
|
|||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
$facture_static->ref = $objp->facnumber;
|
$facture_static->ref = $objp->facnumber;
|
||||||
|
|||||||
@ -302,7 +302,7 @@ if ($result) {
|
|||||||
if ($objp->code_sell_l != $objp->code_sell_p)
|
if ($objp->code_sell_l != $objp->code_sell_p)
|
||||||
$code_sell_p_l_differ = 'color:red';
|
$code_sell_p_l_differ = 'color:red';
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
$facture_static->ref = $objp->facnumber;
|
$facture_static->ref = $objp->facnumber;
|
||||||
|
|||||||
@ -127,7 +127,7 @@ if(!empty($cats))
|
|||||||
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||||
$sommes[$code]['NP'] += $resultNP;
|
$sommes[$code]['NP'] += $resultNP;
|
||||||
$sommes[$code]['N'] += $resultN;
|
$sommes[$code]['N'] += $resultN;
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
print '<td>' . $cpt['account_number'] . '</td>';
|
print '<td>' . $cpt['account_number'] . '</td>';
|
||||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
print '<td>' . $cpt['name_cpt'] . '</td>';
|
||||||
print '<td>' . price($resultNP) . '</td>';
|
print '<td>' . price($resultNP) . '</td>';
|
||||||
|
|||||||
@ -236,7 +236,7 @@ if ($result) {
|
|||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
$facturefournisseur_static->ref = $objp->facnumber;
|
$facturefournisseur_static->ref = $objp->facnumber;
|
||||||
|
|||||||
@ -314,7 +314,7 @@ if ($result) {
|
|||||||
if ($objp->code_buy_l != $objp->code_buy_p)
|
if ($objp->code_buy_l != $objp->code_buy_p)
|
||||||
$code_buy_p_l_differ = 'color:red';
|
$code_buy_p_l_differ = 'color:red';
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print '<tr'. $bc[$var].'>';
|
||||||
|
|
||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
$facturefourn_static->ref = $objp->ref;
|
$facturefourn_static->ref = $objp->ref;
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2012-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -94,7 +94,7 @@ if ($rowid > 0)
|
|||||||
// Define variables to know what current user can do on properties of user linked to edited member
|
// Define variables to know what current user can do on properties of user linked to edited member
|
||||||
if ($object->user_id)
|
if ($object->user_id)
|
||||||
{
|
{
|
||||||
// $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite
|
// $ User is the user who edits, $ object->user_id is the id of the related user in the edited member
|
||||||
$caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
$caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||||
$caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password)
|
$caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||||
@ -209,7 +209,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Creation user
|
// User creation
|
||||||
$company = new Societe($db);
|
$company = new Societe($db);
|
||||||
$result=$company->create_from_member($object,GETPOST('companyname'));
|
$result=$company->create_from_member($object,GETPOST('companyname'));
|
||||||
|
|
||||||
@ -253,7 +253,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$lastname=$_POST["lastname"];
|
$lastname=$_POST["lastname"];
|
||||||
$firstname=$_POST["firstname"];
|
$firstname=$_POST["firstname"];
|
||||||
$morphy=$morphy=$_POST["morphy"];
|
$morphy=$_POST["morphy"];
|
||||||
|
$login=$_POST["login"];
|
||||||
if ($morphy != 'mor' && empty($lastname)) {
|
if ($morphy != 'mor' && empty($lastname)) {
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -264,7 +265,19 @@ if (empty($reshook))
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
if ($morphy == 'mor' && empty($societe)) {
|
||||||
|
$error++;
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
|
||||||
|
}
|
||||||
|
// Test si le login existe deja
|
||||||
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
|
{
|
||||||
|
if (empty($login)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
// Create new object
|
// Create new object
|
||||||
if ($result > 0 && ! $error)
|
if ($result > 0 && ! $error)
|
||||||
{
|
{
|
||||||
@ -482,7 +495,7 @@ if (empty($reshook))
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors');
|
||||||
}
|
}
|
||||||
// Test si le login existe deja
|
// Tests if the login already exists
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
if (empty($login)) {
|
if (empty($login)) {
|
||||||
@ -506,6 +519,11 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($morphy == 'mor' && empty($societe)) {
|
||||||
|
$error++;
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
|
||||||
|
}
|
||||||
if ($morphy != 'mor' && empty($lastname)) {
|
if ($morphy != 'mor' && empty($lastname)) {
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -532,11 +550,11 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Email a peu pres correct et le login n'existe pas
|
// Email about right and login does not exist
|
||||||
$result=$object->create($user);
|
$result=$object->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Categories association
|
// Foundation categories
|
||||||
$memcats = GETPOST('memcats', 'array');
|
$memcats = GETPOST('memcats', 'array');
|
||||||
$object->setCategories($memcats);
|
$object->setCategories($memcats);
|
||||||
|
|
||||||
@ -597,7 +615,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result >= 0 && ! count($object->errors))
|
if ($result >= 0 && ! count($object->errors))
|
||||||
{
|
{
|
||||||
// Send confirmation Email (selon param du type adherent sinon generique)
|
// Send confirmation email (according to parameters of member type. Otherwise generic)
|
||||||
if ($object->email && GETPOST("send_mail"))
|
if ($object->email && GETPOST("send_mail"))
|
||||||
{
|
{
|
||||||
$result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
$result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||||
@ -846,7 +864,7 @@ else
|
|||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
||||||
print '<textarea name="address" wrap="soft" cols="40" rows="2">'.(GETPOST('address','alpha')?GETPOST('address','alpha'):$object->address).'</textarea>';
|
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOST('address','alpha')?GETPOST('address','alpha'):$object->address).'</textarea>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Zip / Town
|
// Zip / Town
|
||||||
@ -1107,7 +1125,7 @@ else
|
|||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||||
print '<textarea name="address" wrap="soft" cols="40" rows="2">'.(isset($_POST["address"])?$_POST["address"]:$object->address).'</textarea>';
|
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(isset($_POST["address"])?$_POST["address"]:$object->address).'</textarea>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Zip / Town
|
// Zip / Town
|
||||||
@ -1361,7 +1379,7 @@ else
|
|||||||
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
||||||
$label=$form->textwithpicto($tmp,$helpcontent,1,'help');
|
$label=$form->textwithpicto($tmp,$helpcontent,1,'help');
|
||||||
|
|
||||||
// Cree un tableau formulaire
|
// Create an array
|
||||||
$formquestion=array();
|
$formquestion=array();
|
||||||
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
|
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"]));
|
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
|
||||||
@ -1549,12 +1567,12 @@ else
|
|||||||
if (! $adht->cotisation)
|
if (! $adht->cotisation)
|
||||||
{
|
{
|
||||||
print $langs->trans("SubscriptionNotRecorded");
|
print $langs->trans("SubscriptionNotRecorded");
|
||||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
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 ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -1737,7 +1737,7 @@ class Adherent extends CommonObject
|
|||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24;
|
$response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24;
|
||||||
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
||||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1';
|
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||||
$response->img=img_object($langs->trans("Members"),"user");
|
$response->img=img_object($langs->trans("Members"),"user");
|
||||||
|
|
||||||
$adherentstatic = new Adherent($this->db);
|
$adherentstatic = new Adherent($this->db);
|
||||||
@ -2006,14 +2006,18 @@ class Adherent extends CommonObject
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if a member is late (subscription late) or not
|
||||||
|
*
|
||||||
|
* @return boolean True if late, False if not late
|
||||||
|
*/
|
||||||
public function hasDelay()
|
public function hasDelay()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
//Only valid members
|
//Only valid members
|
||||||
if ($this->statut <= 0) {
|
if ($this->statut <= 0) return false;
|
||||||
return false;
|
if (! $this->datefin) return false;
|
||||||
}
|
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
|||||||
@ -128,9 +128,10 @@ if ($result)
|
|||||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($statut != '') $param.="&statut=".$statut;
|
if ($statut != '') $param.="&statut=".$statut;
|
||||||
if ($date_select) $param.="&date_select=".$date_select;
|
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_lastname) $param.="&search_lastname=".$search_lastname;
|
||||||
if ($search_login) $param.="&search_login=".$search_login;
|
if ($search_login) $param.="&search_login=".$search_login;
|
||||||
if ($search_acount) $param.="&search_account=".$search_account;
|
if ($search_acount) $param.="&search_account=".$search_account;
|
||||||
|
|||||||
@ -196,7 +196,7 @@ if ($result > 0)
|
|||||||
//print_r($records);
|
//print_r($records);
|
||||||
|
|
||||||
// Affichage arbre
|
// 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))
|
if (! is_array($records))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -176,7 +176,7 @@ print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$oldyear=0;
|
$oldyear=0;
|
||||||
$var=false;
|
$var=true;
|
||||||
foreach ($data as $val)
|
foreach ($data as $val)
|
||||||
{
|
{
|
||||||
$year = $val['year'];
|
$year = $val['year'];
|
||||||
|
|||||||
@ -166,8 +166,8 @@ else if ($action == 'setdoc')
|
|||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||||
{
|
{
|
||||||
// La constante qui a ete lue en avant du nouveau set
|
// The constant that was read before the new set
|
||||||
// on passe donc par une variable pour avoir un affichage coherent
|
// We therefore requires a variable to have a coherent view
|
||||||
$conf->global->COMMANDE_ADDON_PDF = $value;
|
$conf->global->COMMANDE_ADDON_PDF = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,8 +181,8 @@ else if ($action == 'setdoc')
|
|||||||
|
|
||||||
else if ($action == 'setmod')
|
else if ($action == 'setmod')
|
||||||
{
|
{
|
||||||
// TODO Verifier si module numerotation choisi peut etre active
|
// TODO Check if numbering module chosen can be activated
|
||||||
// par appel methode canBeActivated
|
// by calling method canBeActivated
|
||||||
|
|
||||||
dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -314,7 +314,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
|||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
print '<tr '.$bc[$var].'><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||||
print '<textarea name="address" id="address" cols="80" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
|
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
print '<tr '.$bc[$var].'><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||||
|
|||||||
@ -41,6 +41,10 @@ $modules=array(
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
'projet' => array(
|
'projet' => array(
|
||||||
|
array(
|
||||||
|
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
|
||||||
|
'img' => 'project'
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'code' => 'MAIN_DELAY_TASKS_TODO',
|
'code' => 'MAIN_DELAY_TASKS_TODO',
|
||||||
'img' => 'task'
|
'img' => 'task'
|
||||||
|
|||||||
@ -42,7 +42,7 @@ if (! $user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
$label = GETPOST('label','alpha');
|
$label = GETPOST('label','alpha');
|
||||||
$scandir = GETPOST('scandir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
$type='invoice';
|
$type='invoice';
|
||||||
|
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
print "<td align=\"center\">\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"),'switch_off').'</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"),'off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -284,7 +284,7 @@ if ($action == 'create')
|
|||||||
$parent_rowid = $_GET['menuId'];
|
$parent_rowid = $_GET['menuId'];
|
||||||
if ($_GET['menuId'])
|
if ($_GET['menuId'])
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.rowid, m.mainmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId'];
|
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId'];
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
@ -293,6 +293,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$parent_rowid = $menu['rowid'];
|
$parent_rowid = $menu['rowid'];
|
||||||
$parent_mainmenu = $menu['mainmenu'];
|
$parent_mainmenu = $menu['mainmenu'];
|
||||||
|
$parent_leftmenu = $menu['leftmenu'];
|
||||||
$parent_langs = $menu['langs'];
|
$parent_langs = $menu['langs'];
|
||||||
$parent_level = $menu['level'];
|
$parent_level = $menu['level'];
|
||||||
}
|
}
|
||||||
@ -343,7 +344,9 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print '<td><input type="text" size="20" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
|
print '<td><input type="text" size="20" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
|
||||||
}
|
}
|
||||||
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
print '<td>'.$langs->trans('DetailMenuIdParent');
|
||||||
|
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||||
@ -423,9 +426,10 @@ elseif ($action == 'edit')
|
|||||||
|
|
||||||
// MenuId Parent
|
// MenuId Parent
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
|
||||||
print '<td><input type="text" name="fk_menu" value="'.$menu->fk_menu.'" size=10></td>';
|
$valtouse=$menu->fk_menu;
|
||||||
//$menu_handler
|
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
|
||||||
//print '<td><input type="text" size="50" name="handler" value="all"></td>';
|
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
|
||||||
|
print '<td><input type="text" name="fk_menu" value="'.$valtouse.'" size="10"></td>';
|
||||||
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
||||||
|
|
||||||
// Niveau
|
// Niveau
|
||||||
|
|||||||
@ -289,17 +289,18 @@ if ($conf->use_javascript_ajax)
|
|||||||
- la chaine a afficher
|
- la chaine a afficher
|
||||||
ie: data[]= array (index, index parent, chaine )
|
ie: data[]= array (index, index parent, chaine )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//il faut d'abord declarer un element racine de l'arbre
|
//il faut d'abord declarer un element racine de l'arbre
|
||||||
|
|
||||||
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
|
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
|
||||||
|
|
||||||
//puis tous les elements enfants
|
//puis tous les elements enfants
|
||||||
|
|
||||||
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu";
|
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||||
$sql.= " WHERE menu_handler = '".$menu_handler_to_search."'";
|
$sql.= " WHERE menu_handler = '".$menu_handler_to_search."'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
$sql.= " AND fk_menu >= 0";
|
//$sql.= " AND fk_menu >= 0";
|
||||||
$sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same)
|
$sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same)
|
||||||
|
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
@ -314,6 +315,7 @@ if ($conf->use_javascript_ajax)
|
|||||||
$titre = $langs->trans($menu['titre']);
|
$titre = $langs->trans($menu['titre']);
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'rowid'=>$menu['rowid'],
|
'rowid'=>$menu['rowid'],
|
||||||
|
'module'=>$menu['module'],
|
||||||
'fk_menu'=>$menu['fk_menu'],
|
'fk_menu'=>$menu['fk_menu'],
|
||||||
'title'=>$titre,
|
'title'=>$titre,
|
||||||
'mainmenu'=>$menu['mainmenu'],
|
'mainmenu'=>$menu['mainmenu'],
|
||||||
@ -334,10 +336,13 @@ if ($conf->use_javascript_ajax)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $tree_recur_alreadyadded; // This var was def into tree_recur
|
||||||
|
|
||||||
// Appelle de la fonction recursive (ammorce)
|
// Appelle de la fonction recursive (ammorce)
|
||||||
// avec recherche depuis la racine.
|
// avec recherche depuis la racine.
|
||||||
//var_dump($data);
|
//var_dump($data);
|
||||||
tree_recur($data,$data[0],0);
|
tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine'
|
||||||
|
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -346,6 +351,40 @@ if ($conf->use_javascript_ajax)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
// Process remaining records (records that are not linked to root by any path)
|
||||||
|
$remainingdata = array();
|
||||||
|
foreach($data as $datar)
|
||||||
|
{
|
||||||
|
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue;
|
||||||
|
$remainingdata[] = $datar;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($remainingdata))
|
||||||
|
{
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
|
||||||
|
print '<td align="right"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td colspan="2">';
|
||||||
|
|
||||||
|
foreach($remainingdata as $datar)
|
||||||
|
{
|
||||||
|
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');
|
||||||
|
//print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'<br>'."\n";
|
||||||
|
tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -605,7 +605,7 @@ if ($mode != 'marketplace')
|
|||||||
else $text.=$langs->trans("No");
|
else $text.=$langs->trans("No");
|
||||||
|
|
||||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||||
if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu)
|
if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu))
|
||||||
{
|
{
|
||||||
$text.=$langs->trans("Yes");
|
$text.=$langs->trans("Yes");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,20 +77,20 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
|||||||
|
|
||||||
if ($action == 'add_currency')
|
if ($action == 'add_currency')
|
||||||
{
|
{
|
||||||
$code = GETPOST('code', 'alpha');
|
$langs->loadCacheCurrencies('');
|
||||||
$name = GETPOST('name', 'alpha');
|
|
||||||
$rate = GETPOST('rate', 'alpha');
|
|
||||||
|
|
||||||
|
$code = GETPOST('code', 'alpha');
|
||||||
|
$rate = GETPOST('rate', 'alpha');
|
||||||
$currency = new MultiCurrency($db);
|
$currency = new MultiCurrency($db);
|
||||||
$currency->code = $code;
|
$currency->code = $code;
|
||||||
$currency->name = $name;
|
$currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code;
|
||||||
|
|
||||||
if ($currency->create($user) > 0)
|
if ($currency->create($user) > 0)
|
||||||
{
|
{
|
||||||
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
|
||||||
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
|
||||||
}
|
}
|
||||||
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), array());
|
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
|
||||||
}
|
}
|
||||||
elseif ($action == 'update_currency')
|
elseif ($action == 'update_currency')
|
||||||
{
|
{
|
||||||
@ -182,6 +182,7 @@ print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
|||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
||||||
|
|
||||||
|
/* TODO uncomment when the functionality will integrated
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnInvoiceDate").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnInvoiceDate").'</td>';
|
||||||
@ -194,6 +195,7 @@ print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_INVOICE_DATE",$conf->global-
|
|||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
@ -208,6 +210,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
/* TODO uncomment when the functionality will integrated
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").'</td>';
|
||||||
@ -220,7 +223,9 @@ print $form->selectyesno("MULTICURRENCY_BUY_PRICE_IN_CURRENCY",$conf->global->MU
|
|||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* TODO uncomment when the functionality will integrated
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").'</td>';
|
||||||
@ -234,13 +239,17 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
print '<br />';
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||||
|
{
|
||||||
$var=false;
|
$var=false;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("CurrencyLayerAccount").'</td>'."\n";
|
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).'</td>'."\n";
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
print '<td align="right" width="100">';
|
print '<td align="right" width="100">';
|
||||||
print '<form id="form_sync" action="" method="POST">';
|
print '<form id="form_sync" action="" method="POST">';
|
||||||
@ -264,7 +273,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
/* This property seems not used in code, so i comment it
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
|
||||||
@ -290,15 +298,16 @@ print '<input type="text" name="MULTICURRENCY_ALTERNATE_SOURCE" value="'.$conf->
|
|||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
*/
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
print '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Currencies").'</td>'."\n";
|
print '<td>'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).'</td>'."\n";
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
print '<td align="center" width="100">'.$langs->trans("Rate").'</td>'."\n";
|
print '<td align="center" width="100">'.$langs->trans("Rate").'</td>'."\n";
|
||||||
|
|
||||||
@ -307,7 +316,7 @@ print '<tr '.$bc[$var].'>';
|
|||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add_currency">';
|
print '<input type="hidden" name="action" value="add_currency">';
|
||||||
print '<td><input type="text" name="code" value="" size="5" placeholder="'.$langs->trans('code').'" /> - <input type="text" name="name" value="" size="35" placeholder="'.$langs->trans('name').'" /></td>';
|
print '<td>'.$form->selectCurrency('', 'code').'</td>';
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
print '<td align="right" width="300">';
|
print '<td align="right" width="300">';
|
||||||
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('rate').'" /> ';
|
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('rate').'" /> ';
|
||||||
|
|||||||
@ -138,6 +138,7 @@ $list = array (
|
|||||||
'OAUTH_GOOGLE_NAME',
|
'OAUTH_GOOGLE_NAME',
|
||||||
'OAUTH_GOOGLE_ID',
|
'OAUTH_GOOGLE_ID',
|
||||||
'OAUTH_GOOGLE_SECRET',
|
'OAUTH_GOOGLE_SECRET',
|
||||||
|
'OAUTH_GOOGLE_DESC',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'OAUTH_HUBIC_NAME',
|
'OAUTH_HUBIC_NAME',
|
||||||
@ -323,7 +324,11 @@ foreach ($list as $key)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
// Api Name
|
// Api Name
|
||||||
$label = $langs->trans($key[0]);
|
$label = $langs->trans($key[0]);
|
||||||
print '<td colspan="2">'.$label.'</td></tr>';
|
print '<td>'.$label.'</td>';
|
||||||
|
print '<td>';
|
||||||
|
if (! empty($key[3])) print $langs->trans($key[3]);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
if ($supported)
|
if ($supported)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||||
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -377,7 +378,8 @@ if ($mode == 'template' && $user->admin)
|
|||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
for ($line=0; $line < count($printer->listprinterstemplates); $line++) {
|
$max = count($printer->listprinterstemplates);
|
||||||
|
for ($line=0; $line < $max; $line++) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) {
|
if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) {
|
||||||
@ -422,7 +424,8 @@ if ($mode == 'template' && $user->admin)
|
|||||||
print '<th>'.$langs->trans("Tag").'</th>';
|
print '<th>'.$langs->trans("Tag").'</th>';
|
||||||
print '<th>'.$langs->trans("Description").'</th>';
|
print '<th>'.$langs->trans("Description").'</th>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
for ($tag=0; $tag < count($printer->tags); $tag++) {
|
$max = count($printer->tags);
|
||||||
|
for ($tag=0; $tag < $max; $tag++) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td><'.$printer->tags[$tag].'></td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
|
print '<td><'.$printer->tags[$tag].'></td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
|
||||||
|
|||||||
@ -52,14 +52,17 @@ if($action)
|
|||||||
// Mode of stock decrease
|
// Mode of stock decrease
|
||||||
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
if ($action == 'STOCK_CALCULATE_ON_BILL'
|
||||||
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
|| $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER'
|
||||||
|| $action == 'STOCK_CALCULATE_ON_SHIPMENT')
|
|| $action == 'STOCK_CALCULATE_ON_SHIPMENT'
|
||||||
|
|| $action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE')
|
||||||
{
|
{
|
||||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity);
|
||||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
|
||||||
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity);
|
||||||
|
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", '','chaine',0,'',$conf->entity);
|
||||||
if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity);
|
if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||||
if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
|
if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
if ($action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", GETPOST('STOCK_CALCULATE_ON_SHIPMENT_CLOSE','alpha'),'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
// Mode of stock increase
|
// Mode of stock increase
|
||||||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
||||||
@ -203,6 +206,26 @@ else
|
|||||||
print "</td>\n</tr>\n";
|
print "</td>\n</tr>\n";
|
||||||
$found++;
|
$found++;
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td width="60%">'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
|
||||||
|
print '<td width="160" align="right">';
|
||||||
|
if (! empty($conf->expedition->enabled))
|
||||||
|
{
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT_CLOSE\">";
|
||||||
|
print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT_CLOSE",$conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE,1,$disabled);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
|
||||||
|
print "</form>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
|
||||||
|
}
|
||||||
|
print "</td>\n</tr>\n";
|
||||||
|
$found++;
|
||||||
|
|
||||||
/*if (! $found)
|
/*if (! $found)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -290,13 +313,13 @@ $found++;
|
|||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td colspan="2">'.$langs->trans("NoModueToManageStockIncrease").'</td>';
|
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Optio to force stock to be enough before adding a line into document
|
// Option to force stock to be enough before adding a line into document
|
||||||
if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled)
|
if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/admin/payment.php
|
* \file htdocs/admin/supplier_payment.php
|
||||||
* \ingroup facture
|
* \ingroup supplier
|
||||||
* \brief Page to setup invoices payments
|
* \brief Page to setup supplier invoices payments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
@ -30,6 +31,8 @@ $langs->load("admin");
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
|
$langs->load('orders');
|
||||||
|
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
@ -80,16 +83,18 @@ $form=new Form($db);
|
|||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_setup');
|
print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
print "<br />";
|
print "<br>";
|
||||||
|
|
||||||
$head = supplierorder_admin_prepare_head();
|
$head = supplierorder_admin_prepare_head();
|
||||||
dol_fiche_head($head, 'supplierpayment', $langs->trans("SupplierPayment"), 0, 'invoice');
|
dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), 0, 'company');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Numbering module
|
* Numbering module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("SupplierPaymentsNumberingModule"));
|
if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON = 'mod_supplier_payment_bronan';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("PaymentsNumberingModule"));
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -104,7 +104,7 @@ if (file_exists($xmlfile))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr ' . $bc[false] . '><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
print '<tr ' . $bc[false] . '><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ if (file_exists($xmlfile))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr ' . $bc[false] . '><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,6 @@ if (empty($conf->global->MAIN_MODULE_API))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
use \Luracast\Restler\Defaults;
|
|
||||||
|
|
||||||
$api = new DolibarrApi($db);
|
$api = new DolibarrApi($db);
|
||||||
|
|
||||||
|
|||||||
@ -15,9 +15,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Luracast\Restler\Restler;
|
|
||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
use Luracast\Restler\Defaults;
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||||
|
|||||||
@ -55,7 +55,6 @@ if (empty($conf->global->MAIN_MODULE_API))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
use \Luracast\Restler\Defaults;
|
|
||||||
|
|
||||||
$api = new DolibarrApi($db);
|
$api = new DolibarrApi($db);
|
||||||
|
|
||||||
|
|||||||
@ -167,9 +167,10 @@ class Categorie extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id of category
|
* @param int $id Id of category
|
||||||
* @param string $label Label of category
|
* @param string $label Label of category
|
||||||
|
* @param string $type Type of category
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$label='')
|
function fetch($id,$label='',$type='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -182,10 +183,10 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql.= " WHERE rowid = '".$id."'";
|
$sql.= " WHERE rowid = '".$id."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category',1).")";
|
$sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category',1).")";
|
||||||
|
if ($type) $sql.= " AND type = '".$this->db->escape($type)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
@ -255,9 +256,9 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
if ($this->already_exists())
|
if ($this->already_exists())
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ImpossibleAddCat");
|
$this->error=$langs->trans("ImpossibleAddCat", $this->label);
|
||||||
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
|
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
|
||||||
dol_syslog($this->error, LOG_ERR);
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1274,7 +1275,7 @@ class Categorie extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id of element
|
* @param int $id Id of element
|
||||||
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||||
* @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category
|
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
|
||||||
* labels, 'id'= Get array of category IDs
|
* labels, 'id'= Get array of category IDs
|
||||||
* @return mixed Array of category objects or < 0 if KO
|
* @return mixed Array of category objects or < 0 if KO
|
||||||
*/
|
*/
|
||||||
@ -1716,6 +1717,6 @@ class Categorie extends CommonObject
|
|||||||
'categorie_societe'
|
'categorie_societe'
|
||||||
);
|
);
|
||||||
|
|
||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -297,7 +297,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("NoSubCat")."</td></tr>";
|
print "<tr ".$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoSubCat")."</td></tr>";
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ if ($object->type == Categorie::TYPE_PRODUCT)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false].'><td colspan="2">'.$langs->trans("ThisCategoryHasNoProduct")."</td></tr>";
|
print "<tr ".$bc[false].'><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProduct")."</td></tr>";
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -422,7 +422,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoSupplier")."</td></tr>";
|
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoSupplier").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@ if($object->type == Categorie::TYPE_CUSTOMER)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoCustomer")."</td></tr>";
|
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoCustomer").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -529,7 +529,7 @@ if ($object->type == Categorie::TYPE_MEMBER)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoMember")."</td></tr>";
|
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoMember").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -582,7 +582,7 @@ if($object->type == Categorie::TYPE_CONTACT)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoContact")."</td></tr>";
|
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoContact").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false].'><td colspan="3">'.$langs->trans("ThisCategoryHasNoAccount")."</td></tr>";
|
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoAccount").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1445,7 +1445,7 @@ if ($id > 0)
|
|||||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||||
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -1454,7 +1454,7 @@ if ($id > 0)
|
|||||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||||
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
|
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -1463,7 +1463,7 @@ if ($id > 0)
|
|||||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||||
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
|
print img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -932,6 +932,7 @@ class ActionComm extends CommonObject
|
|||||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||||
$response->label = $langs->trans("ActionsToDo");
|
$response->label = $langs->trans("ActionsToDo");
|
||||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
||||||
|
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||||
$response->img = img_object($langs->trans("Actions"),"action");
|
$response->img = img_object($langs->trans("Actions"),"action");
|
||||||
|
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
@ -48,7 +48,7 @@ $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filt
|
|||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||||
|
|
||||||
// If not choice done on calendar owner, we filter on user.
|
// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
|
||||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||||
{
|
{
|
||||||
$filtert=$user->id;
|
$filtert=$user->id;
|
||||||
@ -78,7 +78,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
//$year=GETPOST("year");
|
$resourceid=GETPOST("resourceid","int");
|
||||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
@ -292,6 +292,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
|||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||||
|
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
@ -349,7 +350,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
|||||||
$head = calendars_prepare_head($paramnoaction);
|
$head = calendars_prepare_head($paramnoaction);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
|
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup,'', $resourceid);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
@ -424,7 +425,7 @@ else // If javascript off
|
|||||||
$link.='</a>';
|
$link.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($s, $link.' '.$nav, '');
|
print load_fiche_titre($s, $link.' '.$nav, '', 0, 0, 'tablelistofcalendars');
|
||||||
|
|
||||||
|
|
||||||
// Load events from database into $eventarray
|
// Load events from database into $eventarray
|
||||||
@ -442,12 +443,15 @@ $sql.= ' a.fk_soc, a.fk_contact,';
|
|||||||
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
|
// We must filter on resource table
|
||||||
|
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
$sql.= ' WHERE a.fk_action = ca.id';
|
$sql.= ' WHERE a.fk_action = ca.id';
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||||
|
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||||
@ -933,7 +937,7 @@ if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($even
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$maxnbofchar=18;
|
$maxnbofchar=0;
|
||||||
$cachethirdparties=array();
|
$cachethirdparties=array();
|
||||||
$cachecontacts=array();
|
$cachecontacts=array();
|
||||||
$cacheusers=array();
|
$cacheusers=array();
|
||||||
@ -1312,7 +1316,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||||
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
|
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
|
||||||
print ' -moz-border-radius:4px;" width="100%"><tr>';
|
print ' -moz-border-radius:4px;" width="100%"><tr>';
|
||||||
print '<td class="'.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
|
print '<td class="tdoverflow centpercent '.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
|
||||||
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
||||||
{
|
{
|
||||||
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
|
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
|
||||||
@ -1393,8 +1397,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname,$maxnbofchar).')';
|
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname,$maxnbofchar).')';
|
||||||
|
|
||||||
// If action related to company / contact
|
// If action related to company / contact
|
||||||
$linerelatedto='';$length=16;
|
$linerelatedto='';
|
||||||
if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2);
|
|
||||||
if (! empty($event->societe->id) && $event->societe->id > 0)
|
if (! empty($event->societe->id) && $event->societe->id > 0)
|
||||||
{
|
{
|
||||||
if (! isset($cachethirdparties[$event->societe->id]) || ! is_object($cachethirdparties[$event->societe->id]))
|
if (! isset($cachethirdparties[$event->societe->id]) || ! is_object($cachethirdparties[$event->societe->id]))
|
||||||
@ -1404,7 +1407,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
$cachethirdparties[$event->societe->id]=$thirdparty;
|
$cachethirdparties[$event->societe->id]=$thirdparty;
|
||||||
}
|
}
|
||||||
else $thirdparty=$cachethirdparties[$event->societe->id];
|
else $thirdparty=$cachethirdparties[$event->societe->id];
|
||||||
if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length);
|
if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',0);
|
||||||
}
|
}
|
||||||
if (! empty($event->contact->id) && $event->contact->id > 0)
|
if (! empty($event->contact->id) && $event->contact->id > 0)
|
||||||
{
|
{
|
||||||
@ -1416,7 +1419,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
}
|
}
|
||||||
else $contact=$cachecontacts[$event->contact->id];
|
else $contact=$cachecontacts[$event->contact->id];
|
||||||
if ($linerelatedto) $linerelatedto.=' / ';
|
if ($linerelatedto) $linerelatedto.=' / ';
|
||||||
if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length);
|
if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',0);
|
||||||
}
|
}
|
||||||
if ($linerelatedto) print '<br>'.$linerelatedto;
|
if ($linerelatedto) print '<br>'.$linerelatedto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -36,6 +36,7 @@ $langs->load("agenda");
|
|||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
|
$resourceid=GETPOST("resourceid","int");
|
||||||
$year=GETPOST("year",'int');
|
$year=GETPOST("year",'int');
|
||||||
$month=GETPOST("month",'int');
|
$month=GETPOST("month",'int');
|
||||||
$day=GETPOST("day",'int');
|
$day=GETPOST("day",'int');
|
||||||
@ -154,8 +155,10 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
|
|||||||
$listofextcals=array();
|
$listofextcals=array();
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
||||||
|
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
@ -178,12 +181,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm
|
|||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||||
|
// We must filter on resource table
|
||||||
|
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
$sql.= " WHERE c.id = a.fk_action";
|
$sql.= " WHERE c.id = a.fk_action";
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')";
|
if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')";
|
||||||
|
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||||
@ -199,7 +205,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (
|
|||||||
if ($filtert > 0 || $usergroup > 0)
|
if ($filtert > 0 || $usergroup > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")";
|
if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility
|
||||||
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
}
|
}
|
||||||
@ -242,7 +248,7 @@ if ($resql)
|
|||||||
$head = calendars_prepare_head($param);
|
$head = calendars_prepare_head($param);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup);
|
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup,'',$resourceid);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
// Add link to show birthdays
|
// Add link to show birthdays
|
||||||
@ -288,6 +294,7 @@ if ($resql)
|
|||||||
$nav='';
|
$nav='';
|
||||||
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') $nav.= '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||||
|
if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">';
|
||||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||||
@ -368,7 +375,7 @@ if ($resql)
|
|||||||
$actionstatic->type_code=$obj->type_code;
|
$actionstatic->type_code=$obj->type_code;
|
||||||
$actionstatic->type_label=$obj->type_label;
|
$actionstatic->type_label=$obj->type_label;
|
||||||
$actionstatic->label=$obj->label;
|
$actionstatic->label=$obj->label;
|
||||||
print $actionstatic->getNomUrl(1,28);
|
print $actionstatic->getNomUrl(1,36);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
|
|||||||
@ -76,7 +76,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
|
|||||||
|
|
||||||
//$action=GETPOST('action','alpha');
|
//$action=GETPOST('action','alpha');
|
||||||
$action='show_pertype';
|
$action='show_pertype';
|
||||||
//$year=GETPOST("year");
|
$resourceid=GETPOST("resourceid","int");
|
||||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
@ -202,6 +202,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
|||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||||
|
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
@ -252,6 +253,7 @@ $nav.='<input type="hidden" name="action" value="' . $action . '">';
|
|||||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||||
|
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||||
@ -279,7 +281,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
|||||||
$head = calendars_prepare_head($paramnoaction);
|
$head = calendars_prepare_head($paramnoaction);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
$showextcals=$listofextcals;
|
$showextcals=$listofextcals;
|
||||||
@ -356,12 +358,15 @@ $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
|||||||
$sql.= ' ca.code, ca.color';
|
$sql.= ' ca.code, ca.color';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
|
// We must filter on resource table
|
||||||
|
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
$sql.= ' WHERE a.fk_action = ca.id';
|
$sql.= ' WHERE a.fk_action = ca.id';
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||||
|
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||||
|
|||||||
@ -76,7 +76,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
|
|||||||
|
|
||||||
//$action=GETPOST('action','alpha');
|
//$action=GETPOST('action','alpha');
|
||||||
$action='show_peruser'; //We use 'show_week' mode
|
$action='show_peruser'; //We use 'show_week' mode
|
||||||
//$year=GETPOST("year");
|
$resourceid=GETPOST("resourceid","int");
|
||||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
@ -202,6 +202,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
|||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||||
|
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
@ -255,6 +256,7 @@ $nav.='<input type="hidden" name="action" value="' . $action . '">';
|
|||||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||||
|
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||||
@ -287,7 +289,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
|||||||
$head = calendars_prepare_head($paramnoaction);
|
$head = calendars_prepare_head($paramnoaction);
|
||||||
|
|
||||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid);
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
$showextcals=$listofextcals;
|
$showextcals=$listofextcals;
|
||||||
@ -364,12 +366,15 @@ $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
|||||||
$sql.= ' ca.code, ca.color';
|
$sql.= ' ca.code, ca.color';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||||
|
// We must filter on resource table
|
||||||
|
if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r";
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||||
$sql.= ' WHERE a.fk_action = ca.id';
|
$sql.= ' WHERE a.fk_action = ca.id';
|
||||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||||
|
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||||
|
|||||||
@ -253,7 +253,7 @@ if ($action == 'create')
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($object->label?$object->label:$langs->trans('RequiredField')).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($object->label?$object->label:$langs->trans('RequiredField')).'"></td></tr>';
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($object->name?$object->name:$langs->trans('RequiredField')).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($object->name?$object->name:$langs->trans('RequiredField')).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
|
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||||
print $object->address;
|
print $object->address;
|
||||||
print '</textarea></td></tr>';
|
print '</textarea></td></tr>';
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ elseif ($action == 'edit')
|
|||||||
print '<tr><td>'.$langs->trans('AddressLabel').'</td><td colspan="3"><input type="text" size="40" name="label" value="'.$object->label.'"></td></tr>';
|
print '<tr><td>'.$langs->trans('AddressLabel').'</td><td colspan="3"><input type="text" size="40" name="label" value="'.$object->label.'"></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="40" name="name" value="'.$object->name.'"></td></tr>';
|
print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="40" name="name" value="'.$object->name.'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
|
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||||
print $object->address;
|
print $object->address;
|
||||||
print '</textarea></td></tr>';
|
print '</textarea></td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -457,6 +457,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||||
|
$langs->load("categories");
|
||||||
print '<tr><td>' . $langs->trans("CustomersCategoriesShort") . '</td>';
|
print '<tr><td>' . $langs->trans("CustomersCategoriesShort") . '</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $form->showCategories( $object->id, 'customer', 1 );
|
print $form->showCategories( $object->id, 'customer', 1 );
|
||||||
|
|||||||
@ -517,7 +517,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
@ -571,7 +571,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,9 +122,10 @@ if (GETPOST('clearlist'))
|
|||||||
// Loading Class
|
// Loading Class
|
||||||
$obj = new MailingTargets($db);
|
$obj = new MailingTargets($db);
|
||||||
$obj->clear_target($id);
|
$obj->clear_target($id);
|
||||||
|
/* Avoid this to allow reposition
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
@ -400,7 +401,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
|
|
||||||
$cleartext='';
|
$cleartext='';
|
||||||
if ($allowaddtarget) {
|
if ($allowaddtarget) {
|
||||||
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
|
||||||
}
|
}
|
||||||
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
|
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
|
||||||
|
|
||||||
@ -558,7 +559,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
{
|
{
|
||||||
if ($object->statut < 2)
|
if ($object->statut < 2)
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="8">';
|
print '<tr '.$bc[false].'><td colspan="8" class="opacitymedium">';
|
||||||
print $langs->trans("NoTargetYet");
|
print $langs->trans("NoTargetYet");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,7 +189,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("None").'</td></tr>';
|
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
|
|||||||
@ -1433,7 +1433,7 @@ if ($action == 'create')
|
|||||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 1);
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2570,7 +2570,7 @@ class Propal extends CommonObject
|
|||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $delay_warning/60/60/24;
|
$response->warning_delay = $delay_warning/60/60/24;
|
||||||
$response->label = $label;
|
$response->label = $label;
|
||||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut;
|
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
|
||||||
$response->img = img_object($langs->trans("Propals"),"propal");
|
$response->img = img_object($langs->trans("Propals"),"propal");
|
||||||
|
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
@ -2674,8 +2674,11 @@ class Propal extends CommonObject
|
|||||||
$line->remise_percent=00;
|
$line->remise_percent=00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($num_prods > 0)
|
||||||
|
{
|
||||||
$prodid = mt_rand(1, $num_prods);
|
$prodid = mt_rand(1, $num_prods);
|
||||||
$line->fk_product=$prodids[$prodid];
|
$line->fk_product=$prodids[$prodid];
|
||||||
|
}
|
||||||
|
|
||||||
$this->lines[$xnbp]=$line;
|
$this->lines[$xnbp]=$line;
|
||||||
|
|
||||||
|
|||||||
@ -354,6 +354,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($month) $param.='&month='.$month;
|
if ($month) $param.='&month='.$month;
|
||||||
if ($year) $param.='&year='.$year;
|
if ($year) $param.='&year='.$year;
|
||||||
|
|||||||
@ -283,12 +283,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre" height="24">';
|
print '<tr class="liste_titre" height="24">';
|
||||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("NbOfProposals").'</td>';
|
print '<td align="right">'.$langs->trans("NbOfProposals").'</td>';
|
||||||
print '<td align="center">%</td>';
|
print '<td align="right">%</td>';
|
||||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||||
print '<td align="center">%</td>';
|
print '<td align="right">%</td>';
|
||||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||||
print '<td align="center">%</td>';
|
print '<td align="right">%</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$oldyear=0;
|
$oldyear=0;
|
||||||
|
|||||||
@ -341,22 +341,22 @@ if ($socid > 0)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
||||||
if ($obj->description == '(CREDIT_NOTE)')
|
if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$facturestatic->id=$obj->fk_facture_source;
|
$facturestatic->id=$obj->fk_facture_source;
|
||||||
$facturestatic->ref=$obj->ref;
|
$facturestatic->ref=$obj->ref;
|
||||||
$facturestatic->type=$obj->type;
|
$facturestatic->type=$obj->type;
|
||||||
print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
|
print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($obj->description == '(DEPOSIT)')
|
elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$facturestatic->id=$obj->fk_facture_source;
|
$facturestatic->id=$obj->fk_facture_source;
|
||||||
$facturestatic->ref=$obj->ref;
|
$facturestatic->ref=$obj->ref;
|
||||||
$facturestatic->type=$obj->type;
|
$facturestatic->type=$obj->type;
|
||||||
print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
|
print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -500,22 +500,22 @@ if ($socid > 0)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
|
||||||
if ($obj->description == '(CREDIT_NOTE)')
|
if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$facturestatic->id=$obj->fk_facture_source;
|
$facturestatic->id=$obj->fk_facture_source;
|
||||||
$facturestatic->ref=$obj->ref;
|
$facturestatic->ref=$obj->ref;
|
||||||
$facturestatic->type=$obj->type;
|
$facturestatic->type=$obj->type;
|
||||||
print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1);
|
print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($obj->description == '(DEPOSIT)')
|
elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$facturestatic->id=$obj->fk_facture_source;
|
$facturestatic->id=$obj->fk_facture_source;
|
||||||
$facturestatic->ref=$obj->ref;
|
$facturestatic->ref=$obj->ref;
|
||||||
$facturestatic->type=$obj->type;
|
$facturestatic->type=$obj->type;
|
||||||
print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1);
|
print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -472,6 +472,14 @@ if (empty($reshook))
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
||||||
|
{
|
||||||
|
$ret=$object->classifyUnBilled();
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Positionne ref commande client
|
// Positionne ref commande client
|
||||||
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
||||||
@ -2017,8 +2025,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
// invoice
|
// invoice
|
||||||
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||||
} else {
|
} else {
|
||||||
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')";
|
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
|
||||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'";
|
$filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
||||||
@ -2147,7 +2155,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentConditionsShort');
|
print $langs->trans('PaymentConditionsShort');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editconditions' && $object->brouillon)
|
if ($action != 'editconditions')
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
@ -2165,7 +2173,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('PaymentMode');
|
print $langs->trans('PaymentMode');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editmode' && $object->brouillon)
|
if ($action != 'editmode')
|
||||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
@ -2552,7 +2560,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
||||||
|
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
// Clone
|
// Clone
|
||||||
if ($user->rights->commande->creer) {
|
if ($user->rights->commande->creer) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||||
|
|||||||
@ -478,9 +478,20 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('ORDER_SETDRAFT',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
$this->statut=self::STATUS_DRAFT;
|
$this->statut=self::STATUS_DRAFT;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
|
}else {
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1394,6 +1405,11 @@ class Commande extends CommonOrder
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1847,9 +1863,9 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||||
* Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order
|
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
|
||||||
*
|
*
|
||||||
* @param int $filtre_statut Filter on status
|
* @param int $filtre_statut Filter on shipment status
|
||||||
* @return int <0 if KO, Nb of lines found if OK
|
* @return int <0 if KO, Nb of lines found if OK
|
||||||
*/
|
*/
|
||||||
function loadExpeditions($filtre_statut=-1)
|
function loadExpeditions($filtre_statut=-1)
|
||||||
@ -1918,21 +1934,6 @@ class Commande extends CommonOrder
|
|||||||
else dol_print_error($this->db);
|
else dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a array with sendings by line
|
|
||||||
*
|
|
||||||
* @param int $filtre_statut Filtre sur statut
|
|
||||||
* @return int 0 si OK, <0 si KO
|
|
||||||
*
|
|
||||||
* TODO deprecate, move to Shipping class
|
|
||||||
*/
|
|
||||||
function livraison_array($filtre_statut=self::STATUS_CANCELED)
|
|
||||||
{
|
|
||||||
$delivery = new Livraison($this->db);
|
|
||||||
$deliveryArray = $delivery->livraison_array($filtre_statut);
|
|
||||||
return $deliveryArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a array with the pending stock by product
|
* Return a array with the pending stock by product
|
||||||
*
|
*
|
||||||
@ -2485,6 +2486,56 @@ class Commande extends CommonOrder
|
|||||||
return $this->classifyBilled($user);
|
return $this->classifyBilled($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classify the order as not invoiced
|
||||||
|
*
|
||||||
|
* @return int <0 if ko, >0 if ok
|
||||||
|
*/
|
||||||
|
function classifyUnBilled()
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0';
|
||||||
|
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG);
|
||||||
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->facturee=0; // deprecated
|
||||||
|
$this->billed=0;
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a line in database
|
* Update a line in database
|
||||||
@ -2958,7 +3009,7 @@ class Commande extends CommonOrder
|
|||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->commande->client->warning_delay/60/60/24;
|
$response->warning_delay=$conf->commande->client->warning_delay/60/60/24;
|
||||||
$response->label=$langs->trans("OrdersToProcess");
|
$response->label=$langs->trans("OrdersToProcess");
|
||||||
$response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3';
|
$response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders';
|
||||||
$response->img=img_object($langs->trans("Orders"),"order");
|
$response->img=img_object($langs->trans("Orders"),"order");
|
||||||
|
|
||||||
$generic_commande = new Commande($this->db);
|
$generic_commande = new Commande($this->db);
|
||||||
@ -3262,8 +3313,11 @@ class Commande extends CommonOrder
|
|||||||
$line->total_tva=19.6;
|
$line->total_tva=19.6;
|
||||||
$line->remise_percent=0;
|
$line->remise_percent=0;
|
||||||
}
|
}
|
||||||
|
if ($num_prods > 0)
|
||||||
|
{
|
||||||
$prodid = mt_rand(1, $num_prods);
|
$prodid = mt_rand(1, $num_prods);
|
||||||
$line->fk_product=$prodids[$prodid];
|
$line->fk_product=$prodids[$prodid];
|
||||||
|
}
|
||||||
|
|
||||||
$this->lines[$xnbp]=$line;
|
$this->lines[$xnbp]=$line;
|
||||||
|
|
||||||
|
|||||||
@ -206,7 +206,7 @@ class CommandeStats extends Stats
|
|||||||
|
|
||||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||||
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE ".$this->where;
|
$sql.= " WHERE ".$this->where;
|
||||||
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
|
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
|
||||||
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
|
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
|
||||||
|
|||||||
@ -72,7 +72,7 @@ $optioncss = GETPOST('optioncss','alpha');
|
|||||||
$billed = GETPOST('billed','int');
|
$billed = GETPOST('billed','int');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'commande', $id,'');
|
$result = restrictedArea($user, 'commande', $id,'');
|
||||||
|
|
||||||
@ -124,6 +124,9 @@ $arrayfields=array(
|
|||||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||||
'c.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1),
|
'c.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1),
|
||||||
'c.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)),
|
'c.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)),
|
||||||
|
'c.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
||||||
|
'c.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||||
|
'c.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
||||||
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||||
@ -253,6 +256,7 @@ if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_produc
|
|||||||
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
|
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
|
||||||
|
if ($search_ref_customer) $sql.= natural_search('c.ref_client', $search_ref_customer);
|
||||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
if ($billed != '' && $billed >= 0) $sql.=' AND c.facture = '.$billed;
|
if ($billed != '' && $billed >= 0) $sql.=' AND c.facture = '.$billed;
|
||||||
if ($viewstatut <> '')
|
if ($viewstatut <> '')
|
||||||
@ -310,7 +314,6 @@ if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
|||||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||||
if ($search_ref_customer) $sql.= natural_search('c.ref_client', $search_ref_customer);
|
|
||||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||||
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||||
@ -348,7 +351,7 @@ $sql.= $db->plimit($limit + 1,$offset);
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($socid)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($socid);
|
$soc->fetch($socid);
|
||||||
@ -378,6 +381,7 @@ if ($resql)
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($socid > 0) $param.='&socid='.$socid;
|
if ($socid > 0) $param.='&socid='.$socid;
|
||||||
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
|
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
|
||||||
@ -393,6 +397,8 @@ if ($resql)
|
|||||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||||
|
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
||||||
|
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
@ -479,7 +485,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.tva']['checked'])) print_liste_field_titre($arrayfields['c.tva']['label'],$_SERVER["PHP_SELF"],'c.total_vat','',$param, 'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'],$_SERVER["PHP_SELF"],'c.tva','',$param, 'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$param, 'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$param, 'align="right"',$sortfield,$sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
@ -642,7 +648,7 @@ if ($resql)
|
|||||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Status
|
// Status billed
|
||||||
if (! empty($arrayfields['c.facture']['checked']))
|
if (! empty($arrayfields['c.facture']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||||
@ -740,7 +746,7 @@ if ($resql)
|
|||||||
// stock order and stock order_supplier
|
// stock order and stock order_supplier
|
||||||
$stock_order=0;
|
$stock_order=0;
|
||||||
$stock_order_supplier=0;
|
$stock_order_supplier=0;
|
||||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) // What about other options ?
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) // What about other options ?
|
||||||
{
|
{
|
||||||
if (! empty($conf->commande->enabled))
|
if (! empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
@ -929,10 +935,10 @@ if ($resql)
|
|||||||
// Amount VAT
|
// Amount VAT
|
||||||
if (! empty($arrayfields['c.total_vat']['checked']))
|
if (! empty($arrayfields['c.total_vat']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.price($obj->total_vat)."</td>\n";
|
print '<td align="right">'.price($obj->total_tva)."</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
|
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
|
||||||
$totalarray['totalvat'] += $obj->total_vat;
|
$totalarray['totalvat'] += $obj->total_tva;
|
||||||
}
|
}
|
||||||
// Amount TTC
|
// Amount TTC
|
||||||
if (! empty($arrayfields['c.total_ttc']['checked']))
|
if (! empty($arrayfields['c.total_ttc']['checked']))
|
||||||
|
|||||||
@ -105,6 +105,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
$cssclass="titlefield";
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -46,7 +46,16 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
|||||||
echo price($objectlink->total_ht);
|
echo price($objectlink->total_ht);
|
||||||
} ?></td>
|
} ?></td>
|
||||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
<td align="right">
|
||||||
|
<?php
|
||||||
|
// For now, shipments must stay linked to order, so link is not deletable
|
||||||
|
if($object->element != 'shipping') {
|
||||||
|
?>
|
||||||
|
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1102,6 +1102,7 @@ class Account extends CommonObject
|
|||||||
$sql.= " AND b.fk_account = ba.rowid";
|
$sql.= " AND b.fk_account = ba.rowid";
|
||||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||||
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||||
|
$sql.= " AND clos = 0";
|
||||||
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -105,7 +105,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
$solde = $acc->solde(1);
|
$solde = $acc->solde(1);
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
|
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
|
||||||
print '<td>'.$acc->bank.'</td>';
|
print '<td>'.$acc->bank.'</td>';
|
||||||
print '<td>'.$acc->number.'</td>';
|
print '<td>'.$acc->number.'</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
@ -116,7 +116,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
setEventMessages($acc->error, $acc->errors, 'errors');
|
setEventMessages($acc->error, $acc->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
print $result->nbtodo;
|
print $result->nbtodo;
|
||||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else print $langs->trans("FeatureDisabled");
|
else print $langs->trans("FeatureDisabled");
|
||||||
@ -130,7 +130,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
$total[$acc->currency_code] += $solde;
|
$total[$acc->currency_code] += $solde;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
if (! $found) print '<tr '.$bc[$var].'><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
// Total
|
// Total
|
||||||
foreach ($total as $key=>$solde)
|
foreach ($total as $key=>$solde)
|
||||||
{
|
{
|
||||||
@ -182,7 +182,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! $found)
|
if (! $found)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[false].'><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
// Total
|
// Total
|
||||||
foreach ($total as $key=>$solde)
|
foreach ($total as $key=>$solde)
|
||||||
@ -249,7 +249,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! $found)
|
if (! $found)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
// Total
|
// Total
|
||||||
foreach ($total as $key=>$solde)
|
foreach ($total as $key=>$solde)
|
||||||
|
|||||||
@ -312,8 +312,11 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else if ($links[$key]['type']=='company') {
|
else if ($links[$key]['type']=='company') {
|
||||||
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$links[$key]['url_id'].'">';
|
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$links[$key]['url_id'].'">';
|
||||||
print img_object($langs->trans('ShowCompany'),'company').' ';
|
//print img_object($langs->trans('ShowCompany'),'company').' ';
|
||||||
print $links[$key]['label'];
|
$societe=new Societe($db);
|
||||||
|
$societe->fetch($links[$key]['url_id']);
|
||||||
|
//print $links[$key]['label'];
|
||||||
|
print $societe->getNomUrl(1);
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
else if ($links[$key]['type']=='sc') {
|
else if ($links[$key]['type']=='sc') {
|
||||||
|
|||||||
@ -53,7 +53,20 @@ $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPO
|
|||||||
$search_thirdparty=GETPOST("thirdparty",'alpha');
|
$search_thirdparty=GETPOST("thirdparty",'alpha');
|
||||||
$search_req_nb=GETPOST("req_nb",'alpha');
|
$search_req_nb=GETPOST("req_nb",'alpha');
|
||||||
|
|
||||||
|
$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 (! $sortorder) $sortorder='DESC';
|
||||||
|
if (! $sortfield) $sortfield='b.dateo';
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if (!empty($description)) $param.='&description='.$description;
|
if (!empty($description)) $param.='&description='.$description;
|
||||||
if (!empty($type)) $param.='&type='.$type;
|
if (!empty($type)) $param.='&type='.$type;
|
||||||
if (!empty($debit)) $param.='&debit='.$debit;
|
if (!empty($debit)) $param.='&debit='.$debit;
|
||||||
@ -67,16 +80,10 @@ if (dol_strlen($search_dt_end) > 0)
|
|||||||
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||||
|
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
/*
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
* Actions
|
||||||
$page = GETPOST("page",'int');
|
*/
|
||||||
if ($page == -1) { $page = 0; }
|
|
||||||
$offset = $limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
if (! $sortorder) $sortorder='DESC';
|
|
||||||
if (! $sortfield) $sortfield='b.dateo';
|
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
@ -88,8 +95,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|||||||
$bid="";
|
$bid="";
|
||||||
$search_req_nb='';
|
$search_req_nb='';
|
||||||
$search_thirdparty='';
|
$search_thirdparty='';
|
||||||
|
$thirdparty='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -108,7 +117,8 @@ else $viewline = 50;
|
|||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
|
||||||
$sql.= " b.fk_account, b.fk_type,";
|
$sql.= " b.fk_account, b.fk_type,";
|
||||||
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
|
||||||
$sql.= " bu.label as labelurl, bu.url_id";
|
$sql.= " bu.url_id,";
|
||||||
|
$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
|
||||||
$sql.= " FROM ";
|
$sql.= " FROM ";
|
||||||
if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||||
@ -155,7 +165,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->plimit($limit+1,$offset);
|
$sql.= $db->plimit($limit+1,$offset);
|
||||||
//print $sql;
|
|
||||||
|
|
||||||
dol_syslog('compta/bank/search.php::', LOG_DEBUG);
|
dol_syslog('compta/bank/search.php::', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -190,10 +199,10 @@ if ($resql)
|
|||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' ';
|
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('DateStart') . ' ';
|
||||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||||
$moreforfilter .= ' - ';
|
$moreforfilter .= ' - ';
|
||||||
$moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
$moreforfilter .= $langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
if ($moreforfilter)
|
if ($moreforfilter)
|
||||||
@ -209,9 +218,9 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Type"),$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Type"),$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Numero"));
|
print_liste_field_titre($langs->trans("Numero"),$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"));
|
print_liste_field_titre($langs->trans("Description"),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdParty"));
|
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
@ -225,7 +234,8 @@ if ($resql)
|
|||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
// Numero
|
||||||
|
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
|
print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -287,7 +297,7 @@ if ($resql)
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Num
|
// Num
|
||||||
print '<td class="nowrap">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print "<td>";
|
print "<td>";
|
||||||
@ -306,7 +316,12 @@ if ($resql)
|
|||||||
if ($objp->url_id)
|
if ($objp->url_id)
|
||||||
{
|
{
|
||||||
$companystatic->id=$objp->url_id;
|
$companystatic->id=$objp->url_id;
|
||||||
$companystatic->name=$objp->labelurl;
|
$companystatic->name=$objp->nom;
|
||||||
|
$companystatic->name_alias=$objp->name_alias;
|
||||||
|
$companystatic->client=$objp->client;
|
||||||
|
$companystatic->fournisseur=$objp->fournisseur;
|
||||||
|
$companystatic->code_client=$objp->code_client;
|
||||||
|
$companystatic->code_fournisseur=$objp->code_fournisseur;
|
||||||
print $companystatic->getNomUrl(1);
|
print $companystatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -363,8 +378,9 @@ else
|
|||||||
// If no data to display after a search
|
// If no data to display after a search
|
||||||
if ($_POST["action"] == "search" && ! $num)
|
if ($_POST["action"] == "search" && ! $num)
|
||||||
{
|
{
|
||||||
print $langs->trans("NoRecordFound");
|
print '<div class="opacitymedium">'.$langs->trans("NoRecordFound").'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -72,6 +72,7 @@ $title=$langs->trans("SpecialExpensesArea");
|
|||||||
if ($mode == 'sconly') $title=$langs->trans("SocialContributionsPayments");
|
if ($mode == 'sconly') $title=$langs->trans("SocialContributionsPayments");
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($mode == 'sconly') $param='&mode=sconly';
|
if ($mode == 'sconly') $param='&mode=sconly';
|
||||||
if ($sortfield) $param.='&sortfield='.$sortfield;
|
if ($sortfield) $param.='&sortfield='.$sortfield;
|
||||||
|
|||||||
@ -187,7 +187,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ $childids[]=$user->id;
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
|
$sql = "SELECT s.nom, d.fk_user, s.rowid as socid,"; // Ou
|
||||||
$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment
|
$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment
|
||||||
$sql.= " d.fk_statut,";
|
$sql.= " d.fk_statut,";
|
||||||
$sql.= " u.lastname, u.firstname"; // Qui
|
$sql.= " u.lastname, u.firstname"; // Qui
|
||||||
@ -91,7 +91,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_
|
|||||||
$sql.= " WHERE d.fk_user = u.rowid";
|
$sql.= " WHERE d.fk_user = u.rowid";
|
||||||
$sql.= " AND d.entity = ".$conf->entity;
|
$sql.= " AND d.entity = ".$conf->entity;
|
||||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
|
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND (sc.fk_user = " .$user->id." OR d.fk_soc IS NULL) ";
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
|
|
||||||
if ($search_ref) $sql.=" AND d.rowid=".$search_ref;
|
if ($search_ref) $sql.=" AND d.rowid=".$search_ref;
|
||||||
@ -188,7 +188,7 @@ if ($resql)
|
|||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
|
||||||
// User
|
// User
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$userstatic->id = $obj->rowid;
|
$userstatic->id = $obj->fk_user;
|
||||||
$userstatic->lastname = $obj->lastname;
|
$userstatic->lastname = $obj->lastname;
|
||||||
$userstatic->firstname = $obj->firstname;
|
$userstatic->firstname = $obj->firstname;
|
||||||
print $userstatic->getNomUrl(1);
|
print $userstatic->getNomUrl(1);
|
||||||
|
|||||||
@ -312,6 +312,15 @@ if (empty($reshook))
|
|||||||
if ($result < 0) dol_print_error($db, $object->error);
|
if ($result < 0) dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if ($action == 'setdate_pointoftax' && $user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
$object->date_pointoftax=$date_pointoftax;
|
||||||
|
$result = $object->update($user);
|
||||||
|
if ($result < 0) dol_print_error($db, $object->error);
|
||||||
|
}
|
||||||
|
|
||||||
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -414,20 +423,21 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
|
|
||||||
// Check for mandatory prof id
|
// Check for mandatory prof id (but only if country is than than ours)
|
||||||
for($i = 1; $i < 6; $i ++)
|
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id)
|
||||||
|
{
|
||||||
|
for ($i = 1; $i <= 6; $i++)
|
||||||
{
|
{
|
||||||
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
||||||
$idprof = 'idprof' . $i;
|
$idprof = 'idprof' . $i;
|
||||||
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
|
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
|
||||||
{
|
{
|
||||||
if (! $error)
|
if (! $error) $langs->load("errors");
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
$error++;
|
||||||
|
|
||||||
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
|
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$qualified_for_stock_change = 0;
|
$qualified_for_stock_change = 0;
|
||||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||||
@ -702,12 +712,15 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
// This is a replacement invoice
|
// This is a replacement invoice
|
||||||
$result = $object->fetch($_POST['fac_replacement']);
|
$result = $object->fetch($_POST['fac_replacement']);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$object->date = $dateinvoice;
|
$object->date = $dateinvoice;
|
||||||
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim($_POST['note_public']);
|
$object->note_public = trim($_POST['note_public']);
|
||||||
$object->note = trim($_POST['note']);
|
$object->note = trim($_POST['note']);
|
||||||
$object->ref_client = $_POST['ref_client'];
|
$object->ref_client = $_POST['ref_client'];
|
||||||
@ -752,11 +765,14 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->socid = GETPOST('socid','int');
|
$object->socid = GETPOST('socid','int');
|
||||||
$object->number = $_POST['facnumber'];
|
$object->number = $_POST['facnumber'];
|
||||||
$object->date = $dateinvoice;
|
$object->date = $dateinvoice;
|
||||||
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim($_POST['note_public']);
|
$object->note_public = trim($_POST['note_public']);
|
||||||
$object->note = trim($_POST['note']);
|
$object->note = trim($_POST['note']);
|
||||||
$object->ref_client = $_POST['ref_client'];
|
$object->ref_client = $_POST['ref_client'];
|
||||||
@ -848,7 +864,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard invoice or Deposit invoice created from a Predefined invoice
|
// Standard invoice or Deposit invoice created from a Predefined template invoice
|
||||||
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0)
|
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0)
|
||||||
{
|
{
|
||||||
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
@ -858,12 +874,15 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->socid = GETPOST('socid','int');
|
$object->socid = GETPOST('socid','int');
|
||||||
$object->type = $_POST['type'];
|
$object->type = $_POST['type'];
|
||||||
$object->number = $_POST['facnumber'];
|
$object->number = $_POST['facnumber'];
|
||||||
$object->date = $dateinvoice;
|
$object->date = $dateinvoice;
|
||||||
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim($_POST['note_public']);
|
$object->note_public = trim($_POST['note_public']);
|
||||||
$object->note_private = trim($_POST['note_private']);
|
$object->note_private = trim($_POST['note_private']);
|
||||||
$object->ref_client = $_POST['ref_client'];
|
$object->ref_client = $_POST['ref_client'];
|
||||||
@ -904,6 +923,8 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Si facture standard
|
// Si facture standard
|
||||||
@ -911,6 +932,7 @@ if (empty($reshook))
|
|||||||
$object->type = GETPOST('type');
|
$object->type = GETPOST('type');
|
||||||
$object->number = $_POST['facnumber'];
|
$object->number = $_POST['facnumber'];
|
||||||
$object->date = $dateinvoice;
|
$object->date = $dateinvoice;
|
||||||
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim($_POST['note_public']);
|
$object->note_public = trim($_POST['note_public']);
|
||||||
$object->note_private = trim($_POST['note_private']);
|
$object->note_private = trim($_POST['note_private']);
|
||||||
$object->ref_client = $_POST['ref_client'];
|
$object->ref_client = $_POST['ref_client'];
|
||||||
@ -1224,6 +1246,8 @@ if (empty($reshook))
|
|||||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>';
|
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (!($_POST['situations'] > 0)) {
|
if (!($_POST['situations'] > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||||
@ -1248,6 +1272,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$object->date = $datefacture;
|
$object->date = $datefacture;
|
||||||
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim($_POST['note_public']);
|
$object->note_public = trim($_POST['note_public']);
|
||||||
$object->note = trim($_POST['note']);
|
$object->note = trim($_POST['note']);
|
||||||
$object->ref_client = $_POST['ref_client'];
|
$object->ref_client = $_POST['ref_client'];
|
||||||
@ -2012,7 +2037,7 @@ if ($action == 'create')
|
|||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
$absolute_discount = $soc->getAvailableDiscounts();
|
if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
@ -2396,6 +2421,15 @@ if ($action == 'create')
|
|||||||
print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1);
|
print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date point of tax
|
||||||
|
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||||
|
{
|
||||||
|
print '<tr><td class="fieldrequired">' . $langs->trans('DatePointOfTax') . '</td><td colspan="2">';
|
||||||
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Payment term
|
// Payment term
|
||||||
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
||||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||||
@ -2678,8 +2712,8 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||||
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||||
} else {
|
} else {
|
||||||
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')";
|
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
|
||||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'";
|
$filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
|
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
|
||||||
@ -3097,9 +3131,9 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Remise dispo de type avoir
|
// Remise dispo de type avoir
|
||||||
if (! $absolute_discount)
|
if (! $absolute_discount)
|
||||||
print '<br>';
|
print '<br>';
|
||||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote,
|
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer
|
||||||
// $filtercreditnote, $resteapayer);
|
$more=' ('.$addcreditnote.')';
|
||||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We allow credit note even if amount is higher
|
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $absolute_discount && ! $absolute_creditnote) {
|
if (! $absolute_discount && ! $absolute_creditnote) {
|
||||||
@ -3320,7 +3354,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr ' . $bc[false] . '><td colspan="' . $nbcols . '">' . $langs->trans("None") . '</td><td></td><td></td></tr>';
|
print '<tr ' . $bc[false] . '><td colspan="' . $nbcols . '" class="opacitymedium">' . $langs->trans("None") . '</td><td></td><td></td></tr>';
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
@ -3460,6 +3494,24 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||||
|
{
|
||||||
|
// Date invoice
|
||||||
|
print '<tr><td>';
|
||||||
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('DatePointOfTax');
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate_pointoftax&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
if ($action == 'editdate_pointoftax') {
|
||||||
|
$form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax');
|
||||||
|
} else {
|
||||||
|
print dol_print_date($object->date_pointoftax, 'daytext');
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Conditions de reglement
|
// Conditions de reglement
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
|||||||
@ -666,7 +666,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
|
$facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
|
||||||
$facture->type = self::TYPE_STANDARD;
|
$facture->type = self::TYPE_STANDARD;
|
||||||
$facture->brouillon = 1;
|
$facture->brouillon = 1;
|
||||||
$facture->date = $now;
|
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||||
$facture->socid = $facturerec->socid;
|
$facture->socid = $facturerec->socid;
|
||||||
|
|
||||||
$invoiceidgenerated = $facture->create($user); // This will also update fields of recurring invoice
|
$invoiceidgenerated = $facture->create($user); // This will also update fields of recurring invoice
|
||||||
@ -761,6 +761,8 @@ class FactureRec extends CommonInvoice
|
|||||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||||
|
|
||||||
$prodids = array();
|
$prodids = array();
|
||||||
|
$num_prods = 0;
|
||||||
|
|
||||||
$sql = "SELECT rowid";
|
$sql = "SELECT rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
$sql.= " WHERE entity IN (".getEntity('product', 1).")";
|
$sql.= " WHERE entity IN (".getEntity('product', 1).")";
|
||||||
@ -960,6 +962,7 @@ class FactureRec extends CommonInvoice
|
|||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$this->date_when = $date;
|
$this->date_when = $date;
|
||||||
|
if ($increment_nb_gen_done>0) $this->nb_gen_done++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -263,7 +263,7 @@ class Facture extends CommonInvoice
|
|||||||
$result=$soc->fetch($this->socid);
|
$result=$soc->fetch($this->socid);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="Failed to fetch company";
|
$this->error="Failed to fetch company: ".$soc->error;
|
||||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -309,13 +309,12 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$forceduedate = $this->calculate_date_lim_reglement();
|
$forceduedate = $this->calculate_date_lim_reglement();
|
||||||
|
|
||||||
// Update date and number of last generation of recurring template invoice, before inserting new invoice
|
// For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
|
||||||
if ($_facrec->frequency > 0)
|
if ($_facrec->frequency > 0)
|
||||||
{
|
{
|
||||||
$_facrec->nb_gen_done++;
|
|
||||||
$next_date = $_facrec->getNextDate(); // Calculate next date
|
$next_date = $_facrec->getNextDate(); // Calculate next date
|
||||||
$_facrec->setValueFrom('date_last_gen', $now, '', null, 'date');
|
$_facrec->setValueFrom('date_last_gen', $now, '', null, 'date');
|
||||||
$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1);
|
//$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1.
|
||||||
$_facrec->setNextDate($next_date,1);
|
$_facrec->setNextDate($next_date,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,6 +335,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ", remise_absolue";
|
$sql.= ", remise_absolue";
|
||||||
$sql.= ", remise_percent";
|
$sql.= ", remise_percent";
|
||||||
$sql.= ", datef";
|
$sql.= ", datef";
|
||||||
|
$sql.= ", date_pointoftax";
|
||||||
$sql.= ", note_private";
|
$sql.= ", note_private";
|
||||||
$sql.= ", note_public";
|
$sql.= ", note_public";
|
||||||
$sql.= ", ref_client, ref_int";
|
$sql.= ", ref_client, ref_int";
|
||||||
@ -358,6 +358,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL');
|
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL');
|
||||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||||
|
$sql.= ", ".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null');
|
||||||
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
||||||
@ -665,6 +666,7 @@ class Facture extends CommonInvoice
|
|||||||
$facture->type = $this->type;
|
$facture->type = $this->type;
|
||||||
$facture->socid = $this->socid;
|
$facture->socid = $this->socid;
|
||||||
$facture->date = $this->date;
|
$facture->date = $this->date;
|
||||||
|
$facture->date_pointoftax = $this->date_pointoftax;
|
||||||
$facture->note_public = $this->note_public;
|
$facture->note_public = $this->note_public;
|
||||||
$facture->note_private = $this->note_private;
|
$facture->note_private = $this->note_private;
|
||||||
$facture->ref_client = $this->ref_client;
|
$facture->ref_client = $this->ref_client;
|
||||||
@ -1014,7 +1016,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
||||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||||
$sql.= ', f.datef as df';
|
$sql.= ', f.datef as df, f.date_pointoftax';
|
||||||
$sql.= ', f.date_lim_reglement as dlr';
|
$sql.= ', f.date_lim_reglement as dlr';
|
||||||
$sql.= ', f.datec as datec';
|
$sql.= ', f.datec as datec';
|
||||||
$sql.= ', f.date_valid as datev';
|
$sql.= ', f.date_valid as datev';
|
||||||
@ -1054,6 +1056,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->ref_int = $obj->ref_int;
|
$this->ref_int = $obj->ref_int;
|
||||||
$this->type = $obj->type;
|
$this->type = $obj->type;
|
||||||
$this->date = $this->db->jdate($obj->df);
|
$this->date = $this->db->jdate($obj->df);
|
||||||
|
$this->date_pointoftax = $this->db->jdate($obj->date_pointoftax);
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
$this->date_validation = $this->db->jdate($obj->datev);
|
$this->date_validation = $this->db->jdate($obj->datev);
|
||||||
$this->datem = $this->db->jdate($obj->datem);
|
$this->datem = $this->db->jdate($obj->datem);
|
||||||
@ -1328,6 +1331,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
|
$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
|
||||||
$sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
|
$sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
|
||||||
$sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').",";
|
$sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').",";
|
||||||
|
$sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
|
||||||
$sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
|
$sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
|
||||||
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
|
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
|
||||||
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").",";
|
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").",";
|
||||||
@ -3460,7 +3464,7 @@ class Facture extends CommonInvoice
|
|||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
|
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
|
||||||
$response->label=$langs->trans("CustomerBillsUnpaid");
|
$response->label=$langs->trans("CustomerBillsUnpaid");
|
||||||
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1';
|
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills';
|
||||||
$response->img=img_object($langs->trans("Bills"),"bill");
|
$response->img=img_object($langs->trans("Bills"),"bill");
|
||||||
|
|
||||||
$generic_facture = new Facture($this->db);
|
$generic_facture = new Facture($this->db);
|
||||||
|
|||||||
@ -1256,15 +1256,20 @@ else
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
// Frequencry/Recurring section
|
||||||
if ($object->frequency > 0)
|
if ($object->frequency > 0)
|
||||||
{
|
{
|
||||||
|
if (empty($conf->cron->enabled))
|
||||||
|
{
|
||||||
|
print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name")));
|
||||||
|
}
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Nb of generation already done
|
// Nb of generation already done
|
||||||
print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $object->nb_gen_done?$object->nb_gen_done:'';
|
print $object->nb_gen_done?$object->nb_gen_done:'0';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -1332,6 +1337,12 @@ else
|
|||||||
//if ($object->statut == Facture::STATUS_DRAFT) // there is no draft status on templates.
|
//if ($object->statut == Facture::STATUS_DRAFT) // there is no draft status on templates.
|
||||||
//{
|
//{
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max))
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (empty($object->frequency) || $object->date_when <= $today)
|
if (empty($object->frequency) || $object->date_when <= $today)
|
||||||
{
|
{
|
||||||
@ -1342,6 +1353,7 @@ else
|
|||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CreateBill").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CreateBill").'</a></div>';
|
||||||
@ -1426,6 +1438,7 @@ else
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$param='&socid='.$socid;
|
$param='&socid='.$socid;
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($day) $param.='&day='.$day;
|
if ($day) $param.='&day='.$day;
|
||||||
if ($month) $param.='&month='.$month;
|
if ($month) $param.='&month='.$month;
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/facture/list.php
|
* \file htdocs/compta/facture/list.php
|
||||||
* \ingroup facture
|
* \ingroup facture
|
||||||
* \brief Page to create/see an invoice
|
* \brief List of customer invoices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_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/modules/facture/modules_facture.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
@ -50,7 +51,6 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/c
|
|||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
$langs->load('main');
|
|
||||||
|
|
||||||
$sall=trim(GETPOST('sall'));
|
$sall=trim(GETPOST('sall'));
|
||||||
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
|
||||||
@ -78,8 +78,19 @@ $search_zip=GETPOST('search_zip','alpha');
|
|||||||
$search_state=trim(GETPOST("search_state"));
|
$search_state=trim(GETPOST("search_state"));
|
||||||
$search_country=GETPOST("search_country",'int');
|
$search_country=GETPOST("search_country",'int');
|
||||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||||
|
$search_user = GETPOST('search_user','int');
|
||||||
|
$search_sale = GETPOST('search_sale','int');
|
||||||
|
$day = GETPOST('day','int');
|
||||||
|
$month = GETPOST('month','int');
|
||||||
|
$year = GETPOST('year','int');
|
||||||
|
$day_lim = GETPOST('day_lim','int');
|
||||||
|
$month_lim = GETPOST('month_lim','int');
|
||||||
|
$year_lim = GETPOST('year_lim','int');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$option = GETPOST('option');
|
$option = GETPOST('option');
|
||||||
if ($option == 'late') $filter = 'paye:0';
|
if ($option == 'late') $filter = 'paye:0';
|
||||||
|
$filtre = GETPOST('filtre');
|
||||||
|
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
@ -96,17 +107,6 @@ $pagenext = $page + 1;
|
|||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$contextpage='invoicelist';
|
$contextpage='invoicelist';
|
||||||
|
|
||||||
$search_user = GETPOST('search_user','int');
|
|
||||||
$search_sale = GETPOST('search_sale','int');
|
|
||||||
$day = GETPOST('day','int');
|
|
||||||
$month = GETPOST('month','int');
|
|
||||||
$year = GETPOST('year','int');
|
|
||||||
$day_lim = GETPOST('day_lim','int');
|
|
||||||
$month_lim = GETPOST('month_lim','int');
|
|
||||||
$year_lim = GETPOST('year_lim','int');
|
|
||||||
$filtre = GETPOST('filtre');
|
|
||||||
$toselect = GETPOST('toselect', 'array');
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
@ -140,14 +140,14 @@ $checkedtypetiers=0;
|
|||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||||
|
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
|
||||||
|
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
|
||||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||||
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
|
|
||||||
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
|
|
||||||
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
|
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
|
||||||
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
||||||
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||||
@ -182,13 +182,14 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_user='';
|
$search_user='';
|
||||||
$search_sale='';
|
$search_sale='';
|
||||||
$search_product_category='';
|
$search_product_category='';
|
||||||
$search_ref='';
|
$search_ref='';
|
||||||
$search_refcustomer='';
|
$search_refcustomer='';
|
||||||
|
$search_project='';
|
||||||
$search_societe='';
|
$search_societe='';
|
||||||
$search_montant_ht='';
|
$search_montant_ht='';
|
||||||
$search_montant_vat='';
|
$search_montant_vat='';
|
||||||
@ -624,8 +625,6 @@ if (empty($reshook))
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
@ -633,6 +632,8 @@ $bankaccountstatic=new Account($db);
|
|||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
$formcompany=new FormCompany($db);
|
$formcompany=new FormCompany($db);
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||||
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||||
@ -687,6 +688,7 @@ if ($filtre)
|
|||||||
}
|
}
|
||||||
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
|
||||||
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
|
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
|
||||||
|
if ($search_project) $sql .= natural_search('p.ref', $search_project);
|
||||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
||||||
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
||||||
@ -756,7 +758,8 @@ if (! $sall)
|
|||||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||||
$sql.= ' f.paye, f.fk_statut,';
|
$sql.= ' f.paye, f.fk_statut,';
|
||||||
$sql.= ' f.datec, f.tms,';
|
$sql.= ' f.datec, f.tms,';
|
||||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client';
|
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code';
|
||||||
|
$sql.= ' ,state.code_departement, state.nom';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -792,24 +795,25 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$param='&socid='.$socid;
|
$param='&socid='.$socid;
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($day) $param.='&day='.$day;
|
if ($day) $param.='&day='.urlencode($day);
|
||||||
if ($month) $param.='&month='.$month;
|
if ($month) $param.='&month='.urlencode($month);
|
||||||
if ($year) $param.='&year=' .$year;
|
if ($year) $param.='&year=' .urlencode($year);
|
||||||
if ($day_lim) $param.='&day_lim='.$day_lim;
|
if ($day_lim) $param.='&day_lim='.urlencode($day_lim);
|
||||||
if ($month_lim) $param.='&month_lim='.$month_lim;
|
if ($month_lim) $param.='&month_lim='.urlencode($month_lim);
|
||||||
if ($year_lim) $param.='&year_lim=' .$year_lim;
|
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
|
||||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
|
||||||
if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
|
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
|
||||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
|
||||||
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
|
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
|
||||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
|
||||||
if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category;
|
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category);
|
||||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
|
||||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||||
if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode;
|
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode);
|
||||||
if ($show_files) $param.='&show_files=' .$show_files;
|
if ($show_files) $param.='&show_files=' .$show_files;
|
||||||
if ($option) $param.="&option=".$option;
|
if ($option) $param.="&option=".$option;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
@ -1059,12 +1063,12 @@ if ($resql)
|
|||||||
// Thirpdarty
|
// Thirpdarty
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
|
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
|
||||||
}
|
}
|
||||||
// Town
|
// Town
|
||||||
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||||
// Zip
|
// Zip
|
||||||
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
|
||||||
// State
|
// State
|
||||||
if (! empty($arrayfields['state.nom']['checked']))
|
if (! empty($arrayfields['state.nom']['checked']))
|
||||||
{
|
{
|
||||||
@ -1189,17 +1193,17 @@ if ($resql)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
$datelimit=$db->jdate($obj->datelimite);
|
$datelimit=$db->jdate($obj->datelimite);
|
||||||
|
$facturestatic->id=$obj->facid;
|
||||||
|
$facturestatic->ref=$obj->facnumber;
|
||||||
|
$facturestatic->type=$obj->type;
|
||||||
|
$facturestatic->statut=$obj->fk_statut;
|
||||||
|
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
|
|
||||||
$facturestatic->id=$obj->facid;
|
|
||||||
$facturestatic->ref=$obj->facnumber;
|
|
||||||
$facturestatic->type=$obj->type;
|
|
||||||
$facturestatic->statut=$obj->fk_statut;
|
|
||||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
|
||||||
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
||||||
$paiement = $facturestatic->getSommePaiement();
|
$paiement = $facturestatic->getSommePaiement();
|
||||||
$remaintopay = $obj->total_ttc - $paiement;
|
$remaintopay = $obj->total_ttc - $paiement;
|
||||||
|
|||||||
@ -262,12 +262,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre" height="24">';
|
print '<tr class="liste_titre" height="24">';
|
||||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("NumberOfBills").'</td>';
|
print '<td align="right">'.$langs->trans("NumberOfBills").'</td>';
|
||||||
print '<td align="center">%</td>';
|
print '<td align="right">%</td>';
|
||||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||||
print '<td align="center">%</td>';
|
print '<td align="right">%</td>';
|
||||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||||
print '<td align="center">%</td>';
|
print '<td align="right">%</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$oldyear=0;
|
$oldyear=0;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2015-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||||
@ -543,7 +543,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td colspan="4">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
}
|
}
|
||||||
@ -614,7 +614,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
print '<tr '.$bc[$var].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -877,7 +877,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
|||||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
|
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
|
||||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur";
|
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
|
||||||
$sql.= " ORDER BY ff.date_lim_reglement ASC";
|
$sql.= " ORDER BY ff.date_lim_reglement ASC";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -440,7 +440,7 @@ if ($action == 'new')
|
|||||||
|
|
||||||
if ($i == 0)
|
if ($i == 0)
|
||||||
{
|
{
|
||||||
print '<b>'.$langs->trans("NoWaitingChecks").'</b><br>';
|
print '<div class="opacitymedium">'.$langs->trans("NoWaitingChecks").'</div><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -121,6 +121,7 @@ if ($resql)
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -214,7 +215,7 @@ if ($resql)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td colspan="7">'.$langs->trans("None")."</td>";
|
print '<td colspan="7" class="opacitymedium">'.$langs->trans("None")."</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
463
htdocs/compta/paiement/class/cpaiement.class.php
Normal file
463
htdocs/compta/paiement/class/cpaiement.class.php
Normal file
@ -0,0 +1,463 @@
|
|||||||
|
<?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>
|
||||||
|
*
|
||||||
|
* 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/compat/paiement/class/cpaiement.class.php
|
||||||
|
* \ingroup facture
|
||||||
|
* \brief This file is to manage CRUD function of type of payments
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Cpaiement
|
||||||
|
*/
|
||||||
|
class Cpaiement
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string Id to identify managed objects
|
||||||
|
*/
|
||||||
|
public $element = 'cpaiement';
|
||||||
|
/**
|
||||||
|
* @var string Name of table without prefix where object is stored
|
||||||
|
*/
|
||||||
|
public $table_element = 'c_paiement';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CpaiementLine[] Lines
|
||||||
|
*/
|
||||||
|
public $lines = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $code;
|
||||||
|
public $libelle;
|
||||||
|
public $type;
|
||||||
|
public $active;
|
||||||
|
public $accountancy_code;
|
||||||
|
public $module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB $db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that creates
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, Id of created object if OK
|
||||||
|
*/
|
||||||
|
public function create(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
|
||||||
|
if (isset($this->code)) {
|
||||||
|
$this->code = trim($this->code);
|
||||||
|
}
|
||||||
|
if (isset($this->libelle)) {
|
||||||
|
$this->libelle = trim($this->libelle);
|
||||||
|
}
|
||||||
|
if (isset($this->type)) {
|
||||||
|
$this->type = trim($this->type);
|
||||||
|
}
|
||||||
|
if (isset($this->active)) {
|
||||||
|
$this->active = trim($this->active);
|
||||||
|
}
|
||||||
|
if (isset($this->accountancy_code)) {
|
||||||
|
$this->accountancy_code = trim($this->accountancy_code);
|
||||||
|
}
|
||||||
|
if (isset($this->module)) {
|
||||||
|
$this->module = trim($this->module);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Insert request
|
||||||
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||||
|
|
||||||
|
$sql.= 'id,';
|
||||||
|
$sql.= 'code,';
|
||||||
|
$sql.= 'libelle,';
|
||||||
|
$sql.= 'type,';
|
||||||
|
$sql.= 'active,';
|
||||||
|
$sql.= 'accountancy_code,';
|
||||||
|
$sql.= 'module';
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= ') VALUES (';
|
||||||
|
|
||||||
|
$sql .= ' '.(! isset($this->id)?'NULL':$this->id).',';
|
||||||
|
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
||||||
|
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
|
||||||
|
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
|
||||||
|
$sql .= ' '.(! isset($this->active)?'NULL':$this->active).',';
|
||||||
|
$sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'").',';
|
||||||
|
$sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'");
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= ')';
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
|
|
||||||
|
if (!$notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action to call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||||
|
//if ($result < 0) $error++;
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param int $id Id object
|
||||||
|
* @param string $ref Ref
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetch($id, $ref = null)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = 'SELECT';
|
||||||
|
$sql .= ' t.id,';
|
||||||
|
$sql .= " t.code,";
|
||||||
|
$sql .= " t.libelle,";
|
||||||
|
$sql .= " t.type,";
|
||||||
|
$sql .= " t.active,";
|
||||||
|
$sql .= " t.accountancy_code,";
|
||||||
|
$sql .= " t.module";
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
|
if (null !== $ref) {
|
||||||
|
$sql .= ' WHERE t.code = ' . '\'' . $ref . '\'';
|
||||||
|
} else {
|
||||||
|
$sql .= ' WHERE t.id = ' . $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$numrows = $this->db->num_rows($resql);
|
||||||
|
if ($numrows) {
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->id = $obj->id;
|
||||||
|
|
||||||
|
$this->code = $obj->code;
|
||||||
|
$this->libelle = $obj->libelle;
|
||||||
|
$this->type = $obj->type;
|
||||||
|
$this->active = $obj->active;
|
||||||
|
$this->accountancy_code = $obj->accountancy_code;
|
||||||
|
$this->module = $obj->module;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
if ($numrows) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param string $sortorder Sort Order
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param int $limit offset limit
|
||||||
|
* @param int $offset offset limit
|
||||||
|
* @param array $filter filter array
|
||||||
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = 'SELECT';
|
||||||
|
$sql .= ' t.id,';
|
||||||
|
$sql .= " t.code,";
|
||||||
|
$sql .= " t.libelle,";
|
||||||
|
$sql .= " t.type,";
|
||||||
|
$sql .= " t.active,";
|
||||||
|
$sql .= " t.accountancy_code,";
|
||||||
|
$sql .= " t.module";
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||||
|
|
||||||
|
// Manage filter
|
||||||
|
$sqlwhere = array();
|
||||||
|
if (count($filter) > 0) {
|
||||||
|
foreach ($filter as $key => $value) {
|
||||||
|
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($sqlwhere) > 0) {
|
||||||
|
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($sortfield)) {
|
||||||
|
$sql .= $this->db->order($sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
if (!empty($limit)) {
|
||||||
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
$this->lines = array();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
|
$line = new CpaiementLine();
|
||||||
|
|
||||||
|
$line->id = $obj->id;
|
||||||
|
|
||||||
|
$line->code = $obj->code;
|
||||||
|
$line->libelle = $obj->libelle;
|
||||||
|
$line->type = $obj->type;
|
||||||
|
$line->active = $obj->active;
|
||||||
|
$line->accountancy_code = $obj->accountancy_code;
|
||||||
|
$line->module = $obj->module;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->lines[$line->id] = $line;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return $num;
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that modifies
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function update(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
|
||||||
|
if (isset($this->code)) {
|
||||||
|
$this->code = trim($this->code);
|
||||||
|
}
|
||||||
|
if (isset($this->libelle)) {
|
||||||
|
$this->libelle = trim($this->libelle);
|
||||||
|
}
|
||||||
|
if (isset($this->type)) {
|
||||||
|
$this->type = trim($this->type);
|
||||||
|
}
|
||||||
|
if (isset($this->active)) {
|
||||||
|
$this->active = trim($this->active);
|
||||||
|
}
|
||||||
|
if (isset($this->accountancy_code)) {
|
||||||
|
$this->accountancy_code = trim($this->accountancy_code);
|
||||||
|
}
|
||||||
|
if (isset($this->module)) {
|
||||||
|
$this->module = trim($this->module);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add a control on parameters values
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||||
|
$sql .= ' id = '.(isset($this->id)?$this->id:"null").',';
|
||||||
|
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
|
||||||
|
$sql .= ' libelle = '.(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").',';
|
||||||
|
$sql .= ' type = '.(isset($this->type)?$this->type:"null").',';
|
||||||
|
$sql .= ' active = '.(isset($this->active)?$this->active:"null").',';
|
||||||
|
$sql .= ' accountancy_code = '.(isset($this->accountancy_code)?"'".$this->db->escape($this->accountancy_code)."'":"null").',';
|
||||||
|
$sql .= ' module = '.(isset($this->module)?"'".$this->db->escape($this->module)."'":"null");
|
||||||
|
$sql .= ' WHERE id=' . $this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error && !$notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action calls a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||||
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete object in database
|
||||||
|
*
|
||||||
|
* @param User $user User that deletes
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function delete(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
if (!$notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action calls a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||||
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||||
|
$sql .= ' WHERE id=' . $this->id;
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise object with example values
|
||||||
|
* Id must be 0 if object instance is a specimen
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initAsSpecimen()
|
||||||
|
{
|
||||||
|
$this->id = 0;
|
||||||
|
|
||||||
|
$this->code = '';
|
||||||
|
$this->libelle = '';
|
||||||
|
$this->type = '';
|
||||||
|
$this->active = '';
|
||||||
|
$this->accountancy_code = '';
|
||||||
|
$this->module = '';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -62,6 +62,7 @@ class Paiement extends CommonObject
|
|||||||
var $bank_line; // Id de la ligne d'ecriture bancaire
|
var $bank_line; // Id de la ligne d'ecriture bancaire
|
||||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||||
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
||||||
|
var $fk_paiement; // Type of paiment
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,7 +50,7 @@ $paymentstatic=new Paiement($db);
|
|||||||
$accountstatic=new Account($db);
|
$accountstatic=new Account($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
$search_ref=GETPOST("search_ref","int");
|
$search_ref=GETPOST("search_ref","alpha");
|
||||||
$search_account=GETPOST("search_account","int");
|
$search_account=GETPOST("search_account","int");
|
||||||
$search_paymenttype=GETPOST("search_paymenttype");
|
$search_paymenttype=GETPOST("search_paymenttype");
|
||||||
$search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be able to search on "< x"
|
$search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be able to search on "< x"
|
||||||
@ -203,6 +203,7 @@ if ($resql)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
$param.=(GETPOST("orphelins")?"&orphelins=1":"");
|
$param.=(GETPOST("orphelins")?"&orphelins=1":"");
|
||||||
$param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
|
$param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
|
||||||
|
|||||||
@ -235,7 +235,7 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else print '<tr '.$bc[0].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
|
else print '<tr '.$bc[0].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,7 +159,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>';
|
print '<tr '.$bc[false].'><td colspan="2" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>';
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -279,7 +279,7 @@ if ($total_ttc == 0)
|
|||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ if ($result) {
|
|||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ if ($result) {
|
|||||||
else {
|
else {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -517,7 +517,7 @@ if ($result) {
|
|||||||
else {
|
else {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -606,7 +606,7 @@ if (! empty($conf->salaries->enabled))
|
|||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,7 +629,7 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
{
|
{
|
||||||
$langs->load('trips');
|
$langs->load('trips');
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
$sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||||
@ -688,7 +688,7 @@ if (! empty($conf->expensereport->enabled))
|
|||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -757,7 +757,7 @@ if (! empty($conf->don->enabled))
|
|||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr ".$bc[$var]."><td> </td>";
|
print "<tr ".$bc[$var]."><td> </td>";
|
||||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,6 +127,7 @@ if ($result)
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($typeid) $param.='&typeid='.$typeid;
|
if ($typeid) $param.='&typeid='.$typeid;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -325,8 +325,6 @@ if ($id > 0)
|
|||||||
{
|
{
|
||||||
$head=tax_prepare_head($object);
|
$head=tax_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill');
|
|
||||||
|
|
||||||
// Clone confirmation
|
// Clone confirmation
|
||||||
if ($action === 'clone')
|
if ($action === 'clone')
|
||||||
{
|
{
|
||||||
@ -357,11 +355,16 @@ if ($id > 0)
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
print '<tr><td class="fieldtitle">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||||
print $form->showrefnav($object,'id');
|
print $form->showrefnav($object,'id',$linkback);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
@ -402,7 +405,7 @@ if ($id > 0)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0;
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
@ -488,9 +491,12 @@ if ($id > 0)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
print '<br><div align="center">';
|
print '<div align="center">';
|
||||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
@ -499,7 +505,6 @@ if ($id > 0)
|
|||||||
|
|
||||||
if ($action == 'edit') print "</form>\n";
|
if ($action == 'edit') print "</form>\n";
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
617
htdocs/compta/sociales/class/cchargesociales.class.php
Normal file
617
htdocs/compta/sociales/class/cchargesociales.class.php
Normal file
@ -0,0 +1,617 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016 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>
|
||||||
|
*
|
||||||
|
* 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/compta/sociales/class/cchargesociales.class.php
|
||||||
|
* \ingroup tax
|
||||||
|
* \brief File to manage type of social/fiscal taxes
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Put here all includes required by your class file
|
||||||
|
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 Cchargesociales
|
||||||
|
*/
|
||||||
|
class Cchargesociales
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string Id to identify managed objects
|
||||||
|
*/
|
||||||
|
public $element = 'cchargesociales';
|
||||||
|
/**
|
||||||
|
* @var string Name of table without prefix where object is stored
|
||||||
|
*/
|
||||||
|
public $table_element = 'c_chargesociales';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CchargesocialesLine[] Lines
|
||||||
|
*/
|
||||||
|
public $lines = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $libelle;
|
||||||
|
public $deductible;
|
||||||
|
public $active;
|
||||||
|
public $code;
|
||||||
|
public $fk_pays;
|
||||||
|
public $module;
|
||||||
|
public $accountancy_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB $db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that creates
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, Id of created object if OK
|
||||||
|
*/
|
||||||
|
public function create(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
|
||||||
|
if (isset($this->libelle)) {
|
||||||
|
$this->libelle = trim($this->libelle);
|
||||||
|
}
|
||||||
|
if (isset($this->deductible)) {
|
||||||
|
$this->deductible = trim($this->deductible);
|
||||||
|
}
|
||||||
|
if (isset($this->active)) {
|
||||||
|
$this->active = trim($this->active);
|
||||||
|
}
|
||||||
|
if (isset($this->code)) {
|
||||||
|
$this->code = trim($this->code);
|
||||||
|
}
|
||||||
|
if (isset($this->fk_pays)) {
|
||||||
|
$this->fk_pays = trim($this->fk_pays);
|
||||||
|
}
|
||||||
|
if (isset($this->module)) {
|
||||||
|
$this->module = trim($this->module);
|
||||||
|
}
|
||||||
|
if (isset($this->accountancy_code)) {
|
||||||
|
$this->accountancy_code = trim($this->accountancy_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Insert request
|
||||||
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||||
|
|
||||||
|
$sql.= 'libelle,';
|
||||||
|
$sql.= 'deductible,';
|
||||||
|
$sql.= 'active,';
|
||||||
|
$sql.= 'code,';
|
||||||
|
$sql.= 'fk_pays,';
|
||||||
|
$sql.= 'module';
|
||||||
|
$sql.= 'accountancy_code';
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= ') VALUES (';
|
||||||
|
|
||||||
|
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
|
||||||
|
$sql .= ' '.(! isset($this->deductible)?'NULL':$this->deductible).',';
|
||||||
|
$sql .= ' '.(! isset($this->active)?'NULL':$this->active).',';
|
||||||
|
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
||||||
|
$sql .= ' '.(! isset($this->fk_pays)?'NULL':$this->fk_pays).',';
|
||||||
|
$sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'").',';
|
||||||
|
$sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'");
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= ')';
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
|
|
||||||
|
if (!$notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action to call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||||
|
//if ($result < 0) $error++;
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param int $id Id object
|
||||||
|
* @param string $ref Ref
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetch($id, $ref = null)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = 'SELECT';
|
||||||
|
$sql .= " t.id,";
|
||||||
|
$sql .= " t.libelle,";
|
||||||
|
$sql .= " t.deductible,";
|
||||||
|
$sql .= " t.active,";
|
||||||
|
$sql .= " t.code,";
|
||||||
|
$sql .= " t.fk_pays,";
|
||||||
|
$sql .= " t.module,";
|
||||||
|
$sql .= " t.accountancy_code";
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
|
if (null !== $ref) {
|
||||||
|
$sql .= " WHERE t.code = '" . $this->db->escape($ref) . "'";
|
||||||
|
} else {
|
||||||
|
$sql .= ' WHERE t.id = ' . $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$numrows = $this->db->num_rows($resql);
|
||||||
|
if ($numrows) {
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->id = $obj->id;
|
||||||
|
|
||||||
|
$this->libelle = $obj->libelle;
|
||||||
|
$this->deductible = $obj->deductible;
|
||||||
|
$this->active = $obj->active;
|
||||||
|
$this->code = $obj->code;
|
||||||
|
$this->fk_pays = $obj->fk_pays;
|
||||||
|
$this->module = $obj->module;
|
||||||
|
$this->accountancy_code = $obj->accountancy_code;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
if ($numrows) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param string $sortorder Sort Order
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param int $limit offset limit
|
||||||
|
* @param int $offset offset limit
|
||||||
|
* @param array $filter filter array
|
||||||
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = 'SELECT';
|
||||||
|
$sql .= " t.id,";
|
||||||
|
$sql .= " t.libelle,";
|
||||||
|
$sql .= " t.deductible,";
|
||||||
|
$sql .= " t.active,";
|
||||||
|
$sql .= " t.code,";
|
||||||
|
$sql .= " t.fk_pays,";
|
||||||
|
$sql .= " t.module,";
|
||||||
|
$sql .= " t.accountancy_code";
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||||
|
|
||||||
|
// Manage filter
|
||||||
|
$sqlwhere = array();
|
||||||
|
if (count($filter) > 0) {
|
||||||
|
foreach ($filter as $key => $value) {
|
||||||
|
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($sqlwhere) > 0) {
|
||||||
|
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($sortfield)) {
|
||||||
|
$sql .= $this->db->order($sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
if (!empty($limit)) {
|
||||||
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
$this->lines = array();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
|
$line = new CchargesocialesLine();
|
||||||
|
|
||||||
|
$line->id = $obj->id;
|
||||||
|
$line->libelle = $obj->libelle;
|
||||||
|
$line->deductible = $obj->deductible;
|
||||||
|
$line->active = $obj->active;
|
||||||
|
$line->code = $obj->code;
|
||||||
|
$line->fk_pays = $obj->fk_pays;
|
||||||
|
$line->module = $obj->module;
|
||||||
|
$line->accountancy_code = $obj->accountancy_code;
|
||||||
|
|
||||||
|
$this->lines[$line->id] = $line;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return $num;
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that modifies
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function update(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
|
||||||
|
if (isset($this->libelle)) {
|
||||||
|
$this->libelle = trim($this->libelle);
|
||||||
|
}
|
||||||
|
if (isset($this->deductible)) {
|
||||||
|
$this->deductible = trim($this->deductible);
|
||||||
|
}
|
||||||
|
if (isset($this->active)) {
|
||||||
|
$this->active = trim($this->active);
|
||||||
|
}
|
||||||
|
if (isset($this->code)) {
|
||||||
|
$this->code = trim($this->code);
|
||||||
|
}
|
||||||
|
if (isset($this->fk_pays)) {
|
||||||
|
$this->fk_pays = trim($this->fk_pays);
|
||||||
|
}
|
||||||
|
if (isset($this->module)) {
|
||||||
|
$this->module = trim($this->module);
|
||||||
|
}
|
||||||
|
if (isset($this->accountancy_code)) {
|
||||||
|
$this->accountancy_code = trim($this->accountancy_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add a control on parameters values
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||||
|
$sql .= ' libelle = '.(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").',';
|
||||||
|
$sql .= ' deductible = '.(isset($this->deductible)?$this->deductible:"null").',';
|
||||||
|
$sql .= ' active = '.(isset($this->active)?$this->active:"null").',';
|
||||||
|
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
|
||||||
|
$sql .= ' fk_pays = '.(isset($this->fk_pays)?$this->fk_pays:"null").',';
|
||||||
|
$sql .= ' module = '.(isset($this->module)?"'".$this->db->escape($this->module)."'":"null").',';
|
||||||
|
$sql .= ' accountancy_code = '.(isset($this->accountancy_code)?"'".$this->db->escape($this->accountancy_code)."'":"null");
|
||||||
|
$sql .= ' WHERE id=' . $this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error && !$notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action calls a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||||
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete object in database
|
||||||
|
*
|
||||||
|
* @param User $user User that deletes
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function delete(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
if (!$notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action calls a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||||
|
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||||
|
$sql .= ' WHERE id=' . $this->id;
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an object from its id and create a new one in database
|
||||||
|
*
|
||||||
|
* @param int $fromid Id of object to clone
|
||||||
|
*
|
||||||
|
* @return int New id of clone
|
||||||
|
*/
|
||||||
|
public function createFromClone($fromid)
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
global $user;
|
||||||
|
$error = 0;
|
||||||
|
$object = new Cchargesociales($this->db);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$object->fetch($fromid);
|
||||||
|
// Reset object
|
||||||
|
$object->id = 0;
|
||||||
|
|
||||||
|
// Clear fields
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// Create clone
|
||||||
|
$result = $object->create($user);
|
||||||
|
|
||||||
|
// Other options
|
||||||
|
if ($result < 0) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors = $object->errors;
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End
|
||||||
|
if (!$error) {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return $object->id;
|
||||||
|
} else {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a link to the user card (with optionaly the picto)
|
||||||
|
* Use this->id,this->lastname, this->firstname
|
||||||
|
*
|
||||||
|
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||||
|
* @param string $option On what the link point to
|
||||||
|
* @param integer $notooltip 1=Disable tooltip
|
||||||
|
* @param int $maxlen Max length of visible user name
|
||||||
|
* @param string $morecss Add more css on link
|
||||||
|
* @return string String with URL
|
||||||
|
*/
|
||||||
|
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
|
||||||
|
{
|
||||||
|
global $langs, $conf, $db;
|
||||||
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
|
global $menumanager;
|
||||||
|
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
$companylink = '';
|
||||||
|
|
||||||
|
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
||||||
|
$label.= '<div width="100%">';
|
||||||
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
|
||||||
|
$link = '<a href="'.DOL_URL_ROOT.'/tax/card.php?id='.$this->id.'"';
|
||||||
|
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
||||||
|
$link.= '>';
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
|
if ($withpicto)
|
||||||
|
{
|
||||||
|
$result.=($link.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||||
|
if ($withpicto != 2) $result.=' ';
|
||||||
|
}
|
||||||
|
$result.= $link . $this->ref . $linkend;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le libelle du status d'un user (actif, inactif)
|
||||||
|
*
|
||||||
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
|
* @return string Label of status
|
||||||
|
*/
|
||||||
|
function getLibStatut($mode=0)
|
||||||
|
{
|
||||||
|
return $this->LibStatut($this->status,$mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi le libelle d'un status donne
|
||||||
|
*
|
||||||
|
* @param int $status Id status
|
||||||
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
|
* @return string Label of status
|
||||||
|
*/
|
||||||
|
function LibStatut($status,$mode=0)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
if ($mode == 0)
|
||||||
|
{
|
||||||
|
$prefix='';
|
||||||
|
if ($status == 1) return $langs->trans('Enabled');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 1)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Enabled');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 2)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
|
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 3)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
if ($mode == 4)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
|
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
|
}
|
||||||
|
if ($mode == 5)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
|
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise object with example values
|
||||||
|
* Id must be 0 if object instance is a specimen
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initAsSpecimen()
|
||||||
|
{
|
||||||
|
$this->id = 0;
|
||||||
|
|
||||||
|
$this->libelle = '';
|
||||||
|
$this->deductible = '';
|
||||||
|
$this->active = '';
|
||||||
|
$this->code = '';
|
||||||
|
$this->fk_pays = '';
|
||||||
|
$this->module = '';
|
||||||
|
$this->accountancy_code = '';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -24,8 +24,8 @@
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
|
|
||||||
/** \class ChargeSociales
|
/**
|
||||||
* \brief Classe permettant la gestion des paiements des charges
|
* Classe permettant la gestion des paiements des charges
|
||||||
* La tva collectee n'est calculee que sur les factures payees.
|
* La tva collectee n'est calculee que sur les factures payees.
|
||||||
*/
|
*/
|
||||||
class ChargeSociales extends CommonObject
|
class ChargeSociales extends CommonObject
|
||||||
@ -72,7 +72,7 @@ class ChargeSociales extends CommonObject
|
|||||||
function fetch($id, $ref='')
|
function fetch($id, $ref='')
|
||||||
{
|
{
|
||||||
$sql = "SELECT cs.rowid, cs.date_ech,";
|
$sql = "SELECT cs.rowid, cs.date_ech,";
|
||||||
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,";
|
$sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key,";
|
||||||
$sql.= " c.libelle";
|
$sql.= " c.libelle";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
@ -96,6 +96,7 @@ class ChargeSociales extends CommonObject
|
|||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->paye = $obj->paye;
|
$this->paye = $obj->paye;
|
||||||
$this->periode = $this->db->jdate($obj->periode);
|
$this->periode = $this->db->jdate($obj->periode);
|
||||||
|
$this->import_key = $this->import_key;
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
@ -485,7 +486,7 @@ class ChargeSociales extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function info($id)
|
function info($id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev";
|
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||||
$sql.= " WHERE e.rowid = ".$id;
|
$sql.= " WHERE e.rowid = ".$id;
|
||||||
|
|
||||||
@ -514,7 +515,7 @@ class ChargeSociales extends CommonObject
|
|||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
$this->date_modification = $this->db->jdate($obj->datem);
|
$this->date_modification = $this->db->jdate($obj->datem);
|
||||||
$this->date_validation = $this->db->jdate($obj->datev);
|
$this->date_validation = $this->db->jdate($obj->datev);
|
||||||
|
$this->import_key = $obj->import_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
|
|||||||
@ -69,7 +69,7 @@ else
|
|||||||
$typeid=$_REQUEST['typeid'];
|
$typeid=$_REQUEST['typeid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
@ -138,6 +138,7 @@ if ($resql)
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($year) $param.='&year='.$year;
|
if ($year) $param.='&year='.$year;
|
||||||
if ($typeid) $param.='&typeid='.$typeid;
|
if ($typeid) $param.='&typeid='.$typeid;
|
||||||
@ -210,6 +211,8 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i=0;
|
||||||
|
$totalarray=array();
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -243,7 +246,11 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Amount
|
||||||
print '<td align="right" width="100">'.price($obj->amount).'</td>';
|
print '<td align="right" width="100">'.price($obj->amount).'</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totalttc'] += $obj->amount;
|
||||||
|
|
||||||
// Due date
|
// Due date
|
||||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||||
@ -256,6 +263,22 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show total line
|
||||||
|
if (isset($totalarray['totalttcfield']))
|
||||||
|
{
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -322,7 +322,7 @@ if (is_array($coll_list)) {
|
|||||||
//print load_fiche_titre($vatsup);
|
//print load_fiche_titre($vatsup);
|
||||||
|
|
||||||
//print "<table class=\"noborder\" width=\"100%\">";
|
//print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre liste_titre_topborder\">";
|
||||||
print '<td align="left">'.$langs->trans("Num")."</td>";
|
print '<td align="left">'.$langs->trans("Num")."</td>";
|
||||||
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
print '<td align="left">'.$langs->trans("Supplier")."</td>";
|
||||||
print "<td>".$langs->trans("VATIntra")."</td>";
|
print "<td>".$langs->trans("VATIntra")."</td>";
|
||||||
|
|||||||
@ -479,7 +479,7 @@ else
|
|||||||
|
|
||||||
//print table headers for this quadri - expenses now
|
//print table headers for this quadri - expenses now
|
||||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre liste_titre_topborder">';
|
||||||
print '<td align="left">'.$elementsup.'</td>';
|
print '<td align="left">'.$elementsup.'</td>';
|
||||||
print '<td align="left">'.$productsup.'</td>';
|
print '<td align="left">'.$productsup.'</td>';
|
||||||
if ($modetax == 0)
|
if ($modetax == 0)
|
||||||
|
|||||||
@ -134,6 +134,7 @@ if ($result)
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($typeid) $param.='&typeid='.$typeid;
|
if ($typeid) $param.='&typeid='.$typeid;
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ if ($result)
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("Total").'</td>';
|
||||||
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
||||||
print "<td> </td></tr>";
|
print "<td> </td></tr>";
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,7 @@ if ($result > 0)
|
|||||||
//var_dump($records);
|
//var_dump($records);
|
||||||
|
|
||||||
// Affichage arbre
|
// 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))
|
if (! is_array($records))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -369,6 +369,7 @@ if ($result)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||||
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user