forked from Wavyzz/dolibarr
Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop#1
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -55,3 +55,4 @@ yarn.lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
/factory/
|
||||
|
||||
328
ChangeLog
328
ChangeLog
@@ -5,18 +5,312 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
|
||||
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW: Online proposal signature
|
||||
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
||||
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
||||
NEW: Add option to disable globaly some notifications emails.
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
||||
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
|
||||
NEW: #18689 REST API module: add api key generate / modify right.
|
||||
NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties.
|
||||
NEW: #18046 Add tags on ticket/categories
|
||||
NEW: #18326 Workflow: Close order on shipment closing.
|
||||
NEW: #18770 Can enter the buying price (for Weighted Average Price update) on lines during the reception step
|
||||
NEW: #18814 Add legal form for Sweden
|
||||
NEW: #18820 Accountancy - Add product account in import/export of thirdparty (level 3)
|
||||
NEW: Accountancy - Format FEC/FEC2 - Add column NumFacture
|
||||
NEW: Add $dolibarr_main_db_readonly in conf.php for readonly access.
|
||||
NEW: add auto creation of agenda event on supplier_order cancellation
|
||||
NEW: Add a PDF document template for Manufacturing Orders
|
||||
NEW: Add budget field into task #18986
|
||||
NEW: add cancel button to `classify reception` form on supplier_orders
|
||||
NEW: Added address field into contacts list
|
||||
NEW: Added documents page and send mail possibility in payments
|
||||
NEW: Add edit option in propal
|
||||
NEW: Added linked files page and send mail possibility in payments
|
||||
NEW: Add field date from/to in customer and supplier payment list
|
||||
NEW: Add filter from date to date into action/evt list
|
||||
NEW: Add import / export of MO and BOMLines - Close #18499
|
||||
NEW: Adding accounting export model for iSuite Expert
|
||||
NEW: add link to an element by ref
|
||||
NEW: add missing printFieldListFrom hook call on several lists
|
||||
NEW: add MRP into Object Linked Box
|
||||
NEW: Add option to hide customer code on PDF documents
|
||||
NEW: Add param $nolog to avoid logging into dol_delete_recursive_dir()
|
||||
NEW: Add sale representative in order and invoice list
|
||||
NEW: add a setting to create PDF in PDF/A - 1b format #18990
|
||||
NEW: Add `SOCIETE_SHOW_VAT_IN_LIST` to display VAT number in combo list of thirdparties
|
||||
NEW: Add sortorder on units list
|
||||
NEW: Adds PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES to hide product label in supplier order lines
|
||||
NEW: Add STOCK_MOVEMENT_LIST_HIDE_UNIT_PRICE to hide unit price on some pages
|
||||
NEW: add support for zstd compression
|
||||
NEW: Allow drag and drop on kits
|
||||
NEW: Allow exporting supplier order validation date + validation user
|
||||
NEW: Allows product ref generation after the form is validated with PRODUCT_GENERATE_REF_AFTER_FORM
|
||||
NEW: autocomplete account group when editing an account card
|
||||
NEW: Auto create invoice for payment done on an order with online payment link of order
|
||||
NEW: Can edit fields of proposal when proposal is not yet signed
|
||||
NEW: Can edit the translation key of an overwrote translation key.
|
||||
NEW: can enable/disable external calendar by default
|
||||
NEW: Can hide sender name on PDF documents
|
||||
NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion)
|
||||
NEW: Can set the default BOM on a product
|
||||
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
|
||||
NEW: Can show progression of task into combo list of tasks
|
||||
NEW: can upload the odt file for the product doc template
|
||||
NEW: Contract - Add From/to input on search date
|
||||
NEW: Customer Display with TakePOS
|
||||
NEW: Split Sale in TakePOS
|
||||
NEW: Customer invoice template list - Add input date from/to
|
||||
NEW: date filter on project list and task list From->To
|
||||
NEW: display shipping method and tracking url on shipment list
|
||||
NEW: expense reports: conf to force amounts to be entered only including taxes
|
||||
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
|
||||
NEW: expense reports: show link to already existing overlapping expense report
|
||||
NEW: expense reports: can make project field mandatory on lines
|
||||
NEW: Expose bank account holder, label and number
|
||||
NEW: feature #18986
|
||||
NEW: field and behavior in product object
|
||||
NEW: generate intervention from time spent
|
||||
NEW: holiday: handle monthly balance updates with cronjob
|
||||
NEW: HRM integration, source code
|
||||
NEW: HRM admin - Add tabs
|
||||
NEW: HRM - Include more options to manage/custom dashboard
|
||||
NEW: Increase size of params of actions for emailcollector
|
||||
NEW: Invoice list - Use complete country select field with EEC or not
|
||||
NEW: mass action delete, no more break if at least one object has child
|
||||
NEW: mass action paid on customer invoice list
|
||||
NEW: massaction validate on supplier orders list
|
||||
NEW: Mass action send email to all attendees of an event.
|
||||
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
|
||||
NEW: Option "Add a link on the PDF to make the online payment"
|
||||
NEW: More options to generate PDF (show Frame option, width of picture option)
|
||||
NEW: Preview of pdf files of expense report lines
|
||||
NEW: print without details
|
||||
NEW: project time spent: conf to prevent recording time after X months
|
||||
NEW: rewrite bind accountancy code finding on customer and sales invoice
|
||||
NEW: Societe - Add perentity functionality on customer/supplier accountancy auxiliary account
|
||||
NEW: Survey - Add a clickable link in email send
|
||||
NEW: Social Contributions - Add from/to filter on list
|
||||
NEW: Supplier order and proposal - Add From/to input on search date
|
||||
NEW: Task - Add From/to input on search date
|
||||
NEW: Add theme option THEME_ELDY_USEBORDERONTABLE
|
||||
NEW: The Anti-CSRF protection MAIN_SECURITY_CSRF_WITH_TOKEN is on to value 1 by default
|
||||
NEW: Update SQL : install and migration
|
||||
NEW: Use an ajax call for the clicktodial feature instead of href link.
|
||||
NEW: when multiple order linked to facture, show list into note.
|
||||
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
|
||||
NEW: Editing a page in website module keep old page with name .back
|
||||
NEW: External backups can be downloaded from the "About info page".
|
||||
NEW: Add massaction to switch status on sale / on purchase of a product.
|
||||
|
||||
|
||||
For developers:
|
||||
---------------
|
||||
|
||||
WARNING:
|
||||
NEW: Introduce method hasRight
|
||||
NEW: Can use textarea field into a confirm popup.
|
||||
NEW: Can use the result_mode of mysqli driver. Save memory for list count
|
||||
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
|
||||
NEW: add action trigger for member excluded
|
||||
NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
|
||||
NEW: Add code codebar column on serial/lot structure
|
||||
NEW: Add date_valid and date_approve columns in the list of supplier orders
|
||||
NEW: add hook `beforeBodyClose`
|
||||
NEW: Add hook hookGetEntity.
|
||||
NEW: add hookmanager on note pages
|
||||
NEW: add hook 'menuLeftMenuItems' to filter the leftmenu items
|
||||
NEW: Add the property "copytoclipboard" in modulebuilder
|
||||
NEW: api for knowledgemanagement
|
||||
NEW: API get list of legal form of business
|
||||
NEW: API list of staff units
|
||||
NEW: hook after rank update
|
||||
NEW: printFieldListFrom hook call on several lists
|
||||
NEW: Use lang selector when using a field key 'lang' in modulebuilder
|
||||
NEW: we need to be able to put more filters on deleteByParentField() function
|
||||
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
|
||||
NEW: Experimental feature to manage user sessions in database
|
||||
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
|
||||
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
|
||||
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
|
||||
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
|
||||
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
|
||||
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
|
||||
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
|
||||
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
|
||||
you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 14.0.4 compared to 14.0.3 *****
|
||||
|
||||
FIX: $totalarray is overwritten, totals were lost
|
||||
FIX: 13.0 - due to a typo in the 'mode' parameter, the "first name" column of the list of members displays the full name
|
||||
FIX: 13.0: end date required to edit a ticket message
|
||||
FIX: 13.0 feedback of PR #18993: make ticket messages punctual events with attr percentage = -1
|
||||
FIX: 13.0 PR #18993: add comment on modified part
|
||||
FIX: 13.0: sometimes firstname was mistyped as fistname
|
||||
FIX: 14.0 - civility field of private third party creation form has inadequate width
|
||||
FIX: 14.0 - civility field width inadequate due to select2 calculating the width while the field has no width (display: none)
|
||||
FIX: 14.0 - due to a typo in the 'mode' parameter, the "first name" co…
|
||||
FIX: #18634 : Problem of virtual stock with reception module enabled
|
||||
FIX: #18695 Added ref_ext to supplier invoice
|
||||
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
||||
FIX: #18735
|
||||
FIX: #18767 : Adherent delete
|
||||
FIX: #18797
|
||||
FIX: #18854
|
||||
FIX: #18875 in v14
|
||||
FIX: #18910
|
||||
FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
|
||||
FIX: #18912 Accountancy - SQL error when custom group is added without country defined
|
||||
FIX: #18934 on-registration in the extrafieldsline database for deliveries
|
||||
FIX: #18968
|
||||
FIX: #19008
|
||||
FIX: #19014 - the properties of some fields are not updated when you submit the form
|
||||
FIX: #19210
|
||||
FIX: #19214 : PostgreSQL error on admin/limits.php
|
||||
FIX: #19241 Project - Fix display salary in overview
|
||||
FIX: #19305
|
||||
FIX: 2 columns for total labels
|
||||
FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
|
||||
FIX: Accountancy - If deposit invoice is used, force binding in deposit accounting account to solve transaction
|
||||
FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
|
||||
FIX: Accountancy - Option of export popup are inverted
|
||||
FIX: Accountancy - PHP8
|
||||
FIX: Accountancy - Product admin - SQL error when we affect accounting account with product_perentity activated
|
||||
FIX: Accountancy simplified - Salaries are not present in report
|
||||
FIX: Accountancy - Some correction on export name
|
||||
FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
|
||||
FIX: add warehouse in projects' overview count
|
||||
FIX: also on customer index for automatic binding
|
||||
FIX: Attachment of pdf into shipment when sending email
|
||||
FIX: autocalculation of the supplier price in main currency.
|
||||
FIX: avoid warning if $categories is an id
|
||||
FIX: bad sign of amount stored for multicurrency columns on credit notes
|
||||
FIX: Bad use of a forced contact of another company on PDF/ODT documents
|
||||
FIX: Bad use of dol_concatdesc()
|
||||
FIX: Button text on proposal card for create a invoice
|
||||
FIX: calculateCosts of BOM must not be included into fetch
|
||||
FIX: calculation of balance in conciliation page on desc sorting.
|
||||
FIX: card.php
|
||||
FIX: Change date format of the inventorycode to be equal as mass stock transfert
|
||||
FIX: check if greater 0
|
||||
FIX: close cash with some terminals in TakePOS
|
||||
FIX: compatibility with Multicompany
|
||||
FIX: consistent UX when calling a tab from the invoice card with empty ref/id
|
||||
FIX: default language defined for IN country
|
||||
FIX: Expense report - In edit mode, field qty doesn't accept decimal unlike the create mode
|
||||
FIX: fetch of product with modulebuilder load too much data
|
||||
FIX: filter for export of accounting documents
|
||||
FIX: Filter on categories
|
||||
FIX: generate documents with PDF options
|
||||
FIX: indentation
|
||||
FIX: init hookmanager after loading $conf values
|
||||
FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID
|
||||
FIX: legal issue on expense report pdf (must also show price without tax)
|
||||
FIX: list of categories in stats of supplier invoices
|
||||
FIX: load tranlate array after setting lang
|
||||
FIX: lost superadmin grade after edit user card
|
||||
FIX: missing filter status=1 on rss feeds
|
||||
FIX: missing permission check reported by me@lainwir3d.net on product api
|
||||
FIX: missing return status
|
||||
FIX: missing sql filter by entity
|
||||
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||
FIX: only a superadmin can modify entity
|
||||
FIX: only ones value is return for dictionaries
|
||||
FIX: optional visibility on create card
|
||||
FIX: payment style and html5 tags
|
||||
FIX: payment using wrong type in takepos when too many payment mode
|
||||
FIX: PR#18931 Remove useless explicit call to dol_shutdown
|
||||
FIX: Product accountancy affectation with product_perentity activated (PR #18620)
|
||||
FIX: products/services card: hidden extrafields were overridden
|
||||
FIX: project task list: extrafields could not be displayed
|
||||
FIX: Propal list - Problem of pagination on date
|
||||
FIX: reload user lang
|
||||
FIX: Remove not complete order from the virtual stock
|
||||
FIX: Replenish: SQL error when no warehouse has been created + Warning when there are no warehouses
|
||||
FIX: resource list : Use standard code to handle list filters
|
||||
FIX: restrictedArea for payment delete
|
||||
FIX: Ret PR
|
||||
FIX: second approval back in stable feature as is the setting for minimum amount (last part from PR#14286)
|
||||
FIX: selected lines on supplier invoice create
|
||||
FIX: Selection of type "people" for membership must hide the company
|
||||
FIX: select list of orders not complete when field type of company is on
|
||||
FIX: show end hours in events linked to objects
|
||||
FIX: support of localtax on expense report
|
||||
FIX: task time: can't filter by user with pgsql + show error message
|
||||
FIX: task time: keep on using natural_search
|
||||
FIX: tcpdf vulnerability to roman numeral bomb, cf. tecnickom/TCPDF issue #315
|
||||
FIX: Test when date of invoie is in future (pb with TZ and offset)
|
||||
FIX: Ticket - Card - Wrong font awesome library
|
||||
FIX: Ticket - Duplicate field project when we create ticket from project
|
||||
FIX: translation into email for member at membership validation.
|
||||
FIX: Travis Sanitize SQL
|
||||
FIX: unprivileged user can see task associated with a not allowed project
|
||||
FIX: URGENT: impossible to create an invoice
|
||||
FIX: Use of accent into filename of GED
|
||||
FIX: user date timezone offset
|
||||
FIX: User salary card - translation problem
|
||||
FIX: user without permission can set ticket subject
|
||||
FIX: We need a default price base type in variant creation case with multiprices when parent has been created with only one level price
|
||||
FIX: wrong array key value
|
||||
FIX: wrong check
|
||||
FIX: wrong position of error message
|
||||
Sync transifex.
|
||||
|
||||
***** ChangeLog for 14.0.3 compared to 14.0.2 *****
|
||||
|
||||
FIX: #18698 Supplier invoice list - "alert" checkbox not working
|
||||
FIX: #18735
|
||||
FIX: #18767 : Member delete
|
||||
FIX: #18854
|
||||
FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
|
||||
FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
|
||||
FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
|
||||
FIX: Accountancy - Option of export popup are inverted
|
||||
FIX: Accountancy - Some correction on export name
|
||||
FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
|
||||
FIX: add warehouse in projects' overview count
|
||||
FIX: autocalculation of the supplier price in main currency.
|
||||
FIX: avoid warning if $categories is an id
|
||||
FIX: Bad use of a forced contact of another company on PDF/ODT documents
|
||||
FIX: Button text on proposal card to create a invoice
|
||||
FIX: calculateCosts of BOM must not be included into fetch
|
||||
FIX: check if greater 0
|
||||
FIX: default language defined for IN country
|
||||
FIX: fetch of product with modulebuilder load too much data
|
||||
FIX: Filter on categories
|
||||
FIX: indentation
|
||||
FIX: init hookmanager after loading $conf values
|
||||
FIX: legal issue on expense report pdf (must also show price without tax)
|
||||
FIX: missing filter status=1 on rss feeds
|
||||
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||
FIX: payment using wrong type in takepos when too many payment mode
|
||||
FIX: Product accountancy affectation with product_perentity activated (PR #18620)
|
||||
FIX: products/services card: hidden extrafields were overridden
|
||||
FIX: Propal list - Problem of pagination on date
|
||||
FIX: selected lines on supplier invoice create
|
||||
FIX: Selection of type "people" for membership must hide the company
|
||||
FIX: select list of orders not complete when field type of company is on
|
||||
FIX: support of localtax on expense report
|
||||
FIX: task time: can't filter by user with pgsql + show error message
|
||||
FIX: task time: keep on using natural_search
|
||||
FIX: Test when date of invoie is in future (pb with TZ and offset)
|
||||
FIX: translation into email for member at membership validation.
|
||||
FIX: unprivileged user can see task associated with a not allowed project
|
||||
FIX: user without permission can set ticket subject
|
||||
|
||||
***** ChangeLog for 14.0.2 compared to 14.0.1 *****
|
||||
|
||||
FIX: #18353 Invoice list translation issue
|
||||
@@ -329,6 +623,38 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
|
||||
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
|
||||
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
|
||||
|
||||
FIX: 13.0: class CommandeFournisseurDispatch provides trigger for UPDATE but not for CREATE / DELETE
|
||||
FIX: #18389 Accountancy - Bug on LDcompta10 export for supplier invoice
|
||||
FIX: #18591 : Remove double quotes of SQL Queries for postgresql compatibility
|
||||
FIX: Accountancy - Debug Export Sage50 / CIEL Compta / CIEL Compta Evo (Format XIMPORT)
|
||||
FIX: Accountancy - Some problems of length with general & subledger account
|
||||
FIX: add DISTINCT
|
||||
FIX: an approved holiday can be canceled by an admin.
|
||||
FIX: autocalculation of the supplier price in main currency.
|
||||
FIX: better sql request
|
||||
FIX: cannot add time spend when column ref is not displayed
|
||||
FIX: compatibility postgre sql
|
||||
FIX: holiday card: hooks uninitialized
|
||||
FIX: Invoice - Missing button to reopen an abandoned situation invoice
|
||||
FIX: invoice validation: when checking if any VAT rate has a negative amount, prevent false positives with -1.0E-14 amounts
|
||||
FIX: list of categories in stats of supplier invoices
|
||||
FIX: Manage credit note on situation invoice for calculate margin
|
||||
FIX: method_exists needs object at first param
|
||||
FIX: move fetch_optionnal into $ac_static->fetch()
|
||||
FIX: multicompany transverse mode compatibility
|
||||
FIX: on supplier order, JOIN with product fourn price table must be done with fk_soc too to avoid display several times a same line (because of same supplier product ref)
|
||||
FIX: postgre filter select search extrafield
|
||||
FIX: products/services card: hidden extrafields were overridden
|
||||
FIX: shipping validation workflow: 'ORDER_NEW' trigger called from wrong object
|
||||
FIX: task time: can't filter by user with pgsql + show error message
|
||||
FIX: task time: keep on using natural_search
|
||||
FIX: wrong users count in multicompany transverse mode
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.4 compared to 13.0.3 *****
|
||||
|
||||
16
README-FR.md
16
README-FR.md
@@ -8,12 +8,10 @@ Il est simple d'utilisation et modulaire, vous permettant de n'activez que les f
|
||||
|
||||

|
||||
|
||||
|
||||
## LICENCE
|
||||
|
||||
Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure.
|
||||
|
||||
|
||||
## INSTALLER DOLIBARR
|
||||
|
||||
### Configuration simple
|
||||
@@ -54,7 +52,6 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg
|
||||
|
||||
- Suivez les instructions de l'installateur
|
||||
|
||||
|
||||
## METTRE A JOUR DOLIBARR
|
||||
|
||||
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
|
||||
@@ -65,14 +62,12 @@ Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
|
||||
- Au prochain accès, Dolibarr proposera la page de "mise à jour" des données (si nécessaire).
|
||||
Si un fichier install.lock existe pour verrouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transférés sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents")
|
||||
|
||||
*Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
|
||||
|
||||
Note: *Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
|
||||
|
||||
## CE QUI EST NOUVEAU
|
||||
|
||||
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
|
||||
|
||||
|
||||
## CE QUE DOLIBARR PEUT FAIRE
|
||||
|
||||
### Modules principaux (tous optionnels)
|
||||
@@ -122,7 +117,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Peux être multi-société par ajout du module externe multi-société.
|
||||
- Plusieurs thèmes visuels.
|
||||
- Application simple à utiliser.
|
||||
- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur https://wiki.dolibarr.org/index.php/Prérequis).
|
||||
- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur [https://wiki.dolibarr.org/index.php/Prérequis](https://wiki.dolibarr.org/index.php/Prérequis)).
|
||||
- Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP.
|
||||
- APIs.
|
||||
- Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
|
||||
@@ -142,7 +137,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com).
|
||||
|
||||
|
||||
## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE
|
||||
|
||||
Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
|
||||
@@ -152,18 +146,15 @@ Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
|
||||
- Dolibarr n'embarque pas de Webmail intégré nativement.
|
||||
- Dolibarr ne fait pas le café (pas encore).
|
||||
|
||||
|
||||
## DOCUMENTATION
|
||||
|
||||
La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org).
|
||||
|
||||
|
||||
## CONTRIBUER
|
||||
|
||||
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
||||
|
||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
[](https://github.com/Dolibarr/dolibarr/graphs/contributors)
|
||||
|
||||
## CREDITS
|
||||
|
||||
@@ -171,7 +162,6 @@ Dolibarr est le résultat du travail de nombreux contributeurs depuis des année
|
||||
|
||||
Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT)
|
||||
|
||||
|
||||
## ACTUALITES ET RESEAUX SOCIAUX
|
||||
|
||||
Suivez le projet Dolibarr project sur les réseaux francophones
|
||||
|
||||
123
README.md
123
README.md
@@ -43,7 +43,7 @@ You can use a web server and a supported database (MariaDB, MySQL or PostgreSQL)
|
||||
|
||||
On GNU/Linux, first check if your distribution has already packaged Dolibarr.
|
||||
|
||||
#### Generic install steps:
|
||||
#### Generic install steps
|
||||
|
||||
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
|
||||
|
||||
@@ -71,86 +71,87 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
|
||||
|
||||
- Follow the installer instructions
|
||||
|
||||
|
||||
### Saas/Cloud setup
|
||||
|
||||
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
|
||||
|
||||
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See [https://saas.dolibarr.org](https://saas.dolibarr.org)). However, this third solution is not free.
|
||||
|
||||
## UPGRADING
|
||||
|
||||
Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
|
||||
|
||||
|
||||
- At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
|
||||
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
|
||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
|
||||
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||
|
||||
|
||||
## WHAT'S NEW
|
||||
|
||||
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
|
||||
|
||||
|
||||
## FEATURES
|
||||
|
||||
### Main application/modules (all optional)
|
||||
|
||||
- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
|
||||
- Members/Membership/Foundation management
|
||||
- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
|
||||
- Members/Membership/Foundation management
|
||||
|
||||
Product Management
|
||||
- Products and/or Services catalog
|
||||
- Stock / Warehouse management + Inventory
|
||||
- Barcodes
|
||||
- Batches / Lots / Serials
|
||||
- Product Variants
|
||||
Product Management
|
||||
|
||||
- Products and/or Services catalog
|
||||
- Stock / Warehouse management + Inventory
|
||||
- Barcodes
|
||||
- Batches / Lots / Serials
|
||||
- Product Variants
|
||||
- Bill of Materials (BOM)
|
||||
- Manufacturing Orders
|
||||
- Manufacturing Orders
|
||||
|
||||
Customer/Sales Management
|
||||
- Customers/Prospects + Contacts management
|
||||
- Opportunities or Leads management
|
||||
- Commercial proposals management
|
||||
- Customer Orders management
|
||||
- Contracts/Subscription management
|
||||
- Interventions management
|
||||
- Ticket System
|
||||
- Shipping management
|
||||
- Customer Invoices/Credit notes and payment management
|
||||
- Point of Sale (POS)
|
||||
Customer/Sales Management
|
||||
|
||||
Supplier/Purchase Management
|
||||
- Suppliers/Vendors + Contacts
|
||||
- Supplier (price) requests
|
||||
- Purchase Orders management
|
||||
- Delivery/Receiption
|
||||
- Supplier Invoices/credit notes and payment management
|
||||
- INCOTERMS
|
||||
- Customers/Prospects + Contacts management
|
||||
- Opportunities or Leads management
|
||||
- Commercial proposals management
|
||||
- Customer Orders management
|
||||
- Contracts/Subscription management
|
||||
- Interventions management
|
||||
- Ticket System
|
||||
- Shipping management
|
||||
- Customer Invoices/Credit notes and payment management
|
||||
- Point of Sale (POS)
|
||||
|
||||
Finance / Accounting
|
||||
- Invoices / Payments
|
||||
- Bank accounts management
|
||||
- Direct debit orders management (European SEPA)
|
||||
- Accounting management
|
||||
- Donations management
|
||||
- Loan management
|
||||
- Margins
|
||||
- Reports
|
||||
Supplier/Purchase Management
|
||||
|
||||
Collaboration
|
||||
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
|
||||
- Projects & Tasks management
|
||||
- Ticket System
|
||||
- Suppliers/Vendors + Contacts
|
||||
- Supplier (price) requests
|
||||
- Purchase Orders management
|
||||
- Delivery/Receiption
|
||||
- Supplier Invoices/credit notes and payment management
|
||||
- INCOTERMS
|
||||
|
||||
Finance / Accounting
|
||||
|
||||
- Invoices / Payments
|
||||
- Bank accounts management
|
||||
- Direct debit orders management (European SEPA)
|
||||
- Accounting management
|
||||
- Donations management
|
||||
- Loan management
|
||||
- Margins
|
||||
- Reports
|
||||
|
||||
Collaboration
|
||||
|
||||
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
|
||||
- Projects & Tasks management
|
||||
- Ticket System
|
||||
- Surveys
|
||||
|
||||
HR
|
||||
- Employee's leave requests management
|
||||
- Expense reports
|
||||
- Recruitment management
|
||||
- Timesheets
|
||||
HR
|
||||
|
||||
- Employee's leave requests management
|
||||
- Expense reports
|
||||
- Recruitment management
|
||||
- Timesheets
|
||||
|
||||
### Other application/modules
|
||||
|
||||
@@ -171,7 +172,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
(around 100 modules available by default, 1000+ on the addon market place)
|
||||
|
||||
|
||||
### Other general features
|
||||
|
||||
- Localization in most major languages
|
||||
@@ -190,27 +190,24 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Canadian double taxes (federal/province) and other countries using cumulative VAT
|
||||
- Tunisian tax stamp
|
||||
- Argentina invoice numbering using A,B,C...
|
||||
- Compatible with [European directives] (https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
|
||||
- Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
|
||||
- Compatible with European GDPR rules
|
||||
- ...
|
||||
- Flexible PDF & ODT generation for invoices, proposals, orders...
|
||||
- ...
|
||||
|
||||
|
||||
### System Environment / Requirements
|
||||
|
||||
- PHP
|
||||
- MariaDB, MySQL or PostgreSQL
|
||||
- MariaDB, MySQL or PostgreSQL
|
||||
- Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites.
|
||||
|
||||
See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)
|
||||
|
||||
|
||||
### Extending
|
||||
|
||||
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
|
||||
|
||||
|
||||
## WHAT DOLIBARR CAN'T DO YET
|
||||
|
||||
These are features that Dolibarr does **not** yet fully support:
|
||||
@@ -220,21 +217,18 @@ These are features that Dolibarr does **not** yet fully support:
|
||||
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
|
||||
- Dolibarr can't do coffee (yet)
|
||||
|
||||
|
||||
## DOCUMENTATION
|
||||
|
||||
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
|
||||
|
||||
|
||||
## CONTRIBUTING
|
||||
|
||||
This project exists thanks to all the people who contribute.
|
||||
This project exists thanks to all the people who contribute.
|
||||
Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
|
||||
|
||||
A view on Contributors:
|
||||
|
||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
[](https://github.com/Dolibarr/dolibarr/graphs/contributors)
|
||||
|
||||
## CREDITS
|
||||
|
||||
@@ -242,7 +236,6 @@ Dolibarr is the work of many contributors over the years and uses some fine PHP
|
||||
|
||||
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
|
||||
|
||||
|
||||
## NEWS AND SOCIAL NETWORKS
|
||||
|
||||
Follow Dolibarr project on:
|
||||
@@ -253,8 +246,6 @@ Follow Dolibarr project on:
|
||||
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
||||
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
||||
|
||||
|
||||
### Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]
|
||||
|
||||
|
||||
12
SECURITY.md
12
SECURITY.md
@@ -12,8 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a vulnerability, please use GitHub security advisory at https://github.com/Dolibarr/dolibarr/security/advisories/new (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
|
||||
|
||||
To report a vulnerability, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
|
||||
|
||||
## Hunting vulnerabilities on Dolibarr
|
||||
|
||||
@@ -23,7 +22,7 @@ If you believe you've found a security bug in our service, we are happy to work
|
||||
|
||||
Any type of denial of service attacks is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure.
|
||||
|
||||
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: https://www.dolibarr.org/download) to get access on every side of application.
|
||||
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: [https://www.dolibarr.org/download](https://www.dolibarr.org/download)) to get access on every side of application.
|
||||
|
||||
### User Agent
|
||||
|
||||
@@ -31,8 +30,7 @@ If you try to find bug on Dolibarr, we recommend to append to your user-agent he
|
||||
|
||||
### Account access
|
||||
|
||||
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from https://www.dolibarr.org/download
|
||||
|
||||
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from [https://www.dolibarr.org/download](https://www.dolibarr.org/download)
|
||||
|
||||
## Eligibility and Responsible Disclosure
|
||||
|
||||
@@ -46,7 +44,6 @@ You must avoid tests that could cause degradation or interruption of our service
|
||||
|
||||
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
|
||||
|
||||
|
||||
## Scope for qualified vulnerabilities
|
||||
|
||||
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
|
||||
@@ -64,7 +61,6 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
|
||||
|
||||
Scope is the web application (back office) and the APIs.
|
||||
|
||||
|
||||
## Qualifying vulnerabilities for reporting
|
||||
|
||||
* Remote code execution (RCE)
|
||||
@@ -81,7 +77,6 @@ Scope is the web application (back office) and the APIs.
|
||||
* Software version disclosure (for non admin users only)
|
||||
* Stack traces or path disclosure (for non admin users only)
|
||||
|
||||
|
||||
## Non-qualifying vulnerabilities for reporting
|
||||
|
||||
* "Self" XSS
|
||||
@@ -99,4 +94,3 @@ Scope is the web application (back office) and the APIs.
|
||||
* Software version or private IP disclosure when logged user is admin
|
||||
* Stack traces or path disclosure when logged user is admin
|
||||
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"nnnick/chartjs" : "^2.9",
|
||||
"stripe/stripe-php" : "6.43.1",
|
||||
"maximebf/debugbar" : "1.15.1",
|
||||
"symfony/var-dumper" : "3"
|
||||
"symfony/var-dumper" : "3.2"
|
||||
},
|
||||
"require-dev" : {
|
||||
"php-parallel-lint/php-parallel-lint" : "^0",
|
||||
|
||||
4
composer.lock
generated
4
composer.lock
generated
@@ -591,7 +591,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.0.0",
|
||||
"version": "v3.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
@@ -616,7 +616,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
@@ -168,6 +168,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
- protected $default_monospaced_font = 'courier';
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
|
||||
of the function, replace:
|
||||
|
||||
$roman = '';
|
||||
|
||||
with:
|
||||
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -188,7 +200,10 @@ with:
|
||||
with
|
||||
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
|
||||
|
||||
|
||||
* Fix php fatal error on php 8.0 on tcpdi.php
|
||||
while (list($k, $v) = each($value[1])) {
|
||||
with
|
||||
foreach ($value[1] as $k => $v) {
|
||||
|
||||
JSGANTT:
|
||||
--------
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
BIN
dev/resources/iso-normes/14-pourquoi le format PDF A.pdf
Normal file
BIN
dev/resources/iso-normes/14-pourquoi le format PDF A.pdf
Normal file
Binary file not shown.
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -38,6 +38,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
@@ -51,14 +52,14 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
$permissiontoadd = $user->rights->accounting->chartofaccount;
|
||||
$permissiontodelete = $user->rights->accounting->chartofaccount;
|
||||
$permissiontoadd = !empty($user->rights->accounting->chartofaccount);
|
||||
$permissiontodelete = !empty($user->rights->accounting->chartofaccount);
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -362,7 +363,7 @@ if ($resql) {
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accounting_account', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
// Box to select active chart of account
|
||||
print $langs->trans("Selectchartofaccounts")." : ";
|
||||
@@ -403,6 +404,11 @@ if ($resql) {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
@@ -438,44 +444,33 @@ if ($resql) {
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$totalarray = array();
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['aa.active']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@@ -620,8 +615,13 @@ if ($resql) {
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$totalarray['nbfield']++;
|
||||
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -78,7 +78,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ if ($id) {
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else {
|
||||
|
||||
@@ -48,7 +48,7 @@ $label = GETPOST('label', 'alpha');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -417,13 +417,13 @@ if ($action == 'create') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.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
|
||||
@@ -91,19 +91,19 @@ $tabsql[32] = "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account
|
||||
$tabsqlsort = array();
|
||||
$tabsqlsort[32] = "position ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
// Name of the fields in the result of select to display the dictionary
|
||||
$tabfield = array();
|
||||
$tabfield[32] = "code,label,range_account,category_type,formula,position,country";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
// Name of editing fields for record modification
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[32] = "code,label,range_account,category_type,formula,position,country_id";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
// Name of the fields in the table for inserting a record
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[32] = "code,label,range_account,category_type,formula,position,fk_country";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Name of the rowid if the field is not of type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid = array();
|
||||
@@ -151,7 +151,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
if ($value == 'range_account' && empty($_POST['range_account'])) {
|
||||
continue;
|
||||
}
|
||||
if ($value == 'country' || $value == 'country_id') {
|
||||
if (($value == 'country' || $value == 'country_id') && (!empty($_POST['country_id']))) {
|
||||
continue;
|
||||
}
|
||||
if (!GETPOSTISSET($value) || GETPOST($value) == '') {
|
||||
@@ -176,6 +176,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
if ($fieldnamekey == 'category_type') {
|
||||
$fieldnamekey = 'Calculated';
|
||||
}
|
||||
if ($fieldnamekey == 'country') {
|
||||
$fieldnamekey = 'Country';
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@@ -263,7 +266,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
// If check ok and action modify, we modify the line
|
||||
if ($ok && GETPOST('actionmodify', 'alpha')) {
|
||||
if ($tabrowid[$id]) {
|
||||
$rowidcol = $tabrowid[$id];
|
||||
@@ -430,12 +433,12 @@ print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'</span><br><br>';
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
// Confirmation of the deletion of the line
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id > 0 ? '&search_country_id='.$search_country_id : ''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
// Complete search query with sorting criteria
|
||||
$sql = $tabsql[$id];
|
||||
|
||||
if ($search_country_id > 0) {
|
||||
@@ -517,7 +520,7 @@ if ($tabname[$id]) {
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else {
|
||||
@@ -634,14 +637,14 @@ if ($resql) {
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield = 1; // By defaut
|
||||
// Determines the name of the field in relation to the possible names
|
||||
// in data dictionaries
|
||||
$showfield = 1; // By default
|
||||
$class = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By default
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'source') {
|
||||
$valuetoshow = $langs->trans("Contact");
|
||||
@@ -741,7 +744,7 @@ if ($resql) {
|
||||
print '<td></td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
@@ -109,7 +109,7 @@ foreach ($list_account_main as $key) {
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ $list_account_main = array(
|
||||
);
|
||||
|
||||
$list_account = array();
|
||||
|
||||
$list_account[] = '---Product---';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
@@ -63,6 +64,7 @@ if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
|
||||
|
||||
$list_account[] = '---Service---';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
@@ -74,11 +76,11 @@ if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
|
||||
|
||||
$list_account[] = '---Others---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||
if ($conf->banque->enabled) {
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
|
||||
}
|
||||
@@ -96,6 +98,7 @@ if ($conf->loan->enabled) {
|
||||
if ($conf->societe->enabled) {
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -154,6 +157,7 @@ print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
// Define main accounts for thirdparty
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("ThirdParties").' | '.$langs->trans("Users").'</td><td></td></tr>';
|
||||
|
||||
@@ -164,17 +168,29 @@ foreach ($list_account_main as $key) {
|
||||
$keydesc = $key.'_Desc';
|
||||
|
||||
$htmltext = $langs->trans($keydesc);
|
||||
print '<td class="fieldrequired" width="50%">';
|
||||
print '<td class="fieldrequired">';
|
||||
if ($key == 'ACCOUNTING_ACCOUNT_CUSTOMER') {
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
} elseif ($key == 'ACCOUNTING_ACCOUNT_SUPPLIER') {
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
} else {
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"');
|
||||
}
|
||||
print $form->textwithpicto($label, $htmltext);
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accountsmain');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
foreach ($list_account as $key) {
|
||||
$reg = array();
|
||||
if (preg_match('/---(.*)---/', $key, $reg)) {
|
||||
@@ -183,10 +199,33 @@ foreach ($list_account as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">'.$label.'</td>';
|
||||
print '<td>';
|
||||
if (preg_match('/^ACCOUNTING_PRODUCT/', $key)) {
|
||||
print img_picto('', 'product', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_SERVICE/', $key)) {
|
||||
print img_picto('', 'service', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
|
||||
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
|
||||
print img_picto('', 'vat', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
|
||||
print img_picto('', 'bill', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
|
||||
print img_picto('', 'loan', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^DONATION_ACCOUNTING/', $key)) {
|
||||
print img_picto('', 'donation', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ADHERENT_SUBSCRIPTION/', $key)) {
|
||||
print img_picto('', 'member', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
|
||||
print img_picto('', 'question', 'class="pictofixedwidth"');
|
||||
}
|
||||
print $label;
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
|
||||
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -194,7 +233,7 @@ foreach ($list_account as $key) {
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ $linkback = '';
|
||||
print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy');
|
||||
|
||||
|
||||
print "\n".'<script type="text/javascript" language="javascript">'."\n";
|
||||
print "\n".'<script type="text/javascript">'."\n";
|
||||
print 'jQuery(document).ready(function () {'."\n";
|
||||
print ' function initfields()'."\n";
|
||||
print ' {'."\n";
|
||||
|
||||
@@ -52,7 +52,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->fiscalyear->write) { // If we can read accounting records, we should be able to see fiscal year.
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) { // If we can read accounting records, we should be able to see fiscal year.
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,6 @@ if ($result) {
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
|
||||
|
||||
// Load attribute_label
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@@ -33,7 +33,7 @@ $langs->loadLangs(array("admin", "compta"));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->fiscalyear->write) {
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@@ -260,6 +260,22 @@ $linkback = '';
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($title, $linkback, 'accountancy');
|
||||
|
||||
// Show message if accountancy hidden options are activated to help to resolve some problems
|
||||
if (!$user->admin) {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
|
||||
}
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
@@ -453,7 +453,7 @@ if ($id) {
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else {
|
||||
@@ -612,7 +612,7 @@ if ($id) {
|
||||
print '</td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -41,15 +42,18 @@ $langs->loadLangs(array("companies", "compta", "accountancy", "products"));
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->bind->write) {
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// search & action GETPOST
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||
$chk_prod = GETPOST('chk_prod', 'array');
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$account_number_buy = GETPOST('account_number_buy');
|
||||
$account_number_sell = GETPOST('account_number_sell');
|
||||
$changeaccount = GETPOST('changeaccount', 'array');
|
||||
@@ -68,8 +72,8 @@ $search_onsell = GETPOST('search_onsell', 'alpha');
|
||||
$search_onpurchase = GETPOST('search_onpurchase', 'alpha');
|
||||
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
|
||||
$btn_changetype = GETPOST('changetype', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (empty($accounting_product_mode)) {
|
||||
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
@@ -164,7 +168,7 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($btn_changeaccount)) {
|
||||
if (!empty($chk_prod) && $massaction === 'changeaccount') {
|
||||
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (!empty($chk_prod) && in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
$accounting = new AccountingAccount($db);
|
||||
@@ -198,7 +202,7 @@ if ($action == 'update') {
|
||||
$nb_exists = $db->num_rows($resql_exists);
|
||||
if ($nb_exists <= 0) {
|
||||
// insert
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')";
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")";
|
||||
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
|
||||
} else {
|
||||
$obj_exists = $db->fetch_object($resql_exists);
|
||||
@@ -253,35 +257,35 @@ $form = new FormAccounting($db);
|
||||
// so we need to get those the rowid of those default value first
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is already exists accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servbuy = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT'), 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT'), 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT'), 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT'), 1);
|
||||
$aarowid_servsell = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT'), 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT'), 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT'), 1);
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT'), 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT'), 1);
|
||||
|
||||
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||
|
||||
llxHeader('', $langs->trans("ProductsBinding"));
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgverid = getDolGlobalString('CHARTOFACCOUNTS');
|
||||
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) {
|
||||
$pcgvercode = $pcgverid;
|
||||
@@ -435,11 +439,27 @@ if ($result) {
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$arrayofmassactions = array(
|
||||
'changeaccount'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Save")
|
||||
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
);
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions, 1);
|
||||
}
|
||||
|
||||
$buttonsave = '<input type="submit" class="button button-save" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
|
||||
//print '<br><div class="center">'.$buttonsave.'</div>';
|
||||
|
||||
$texte = $langs->trans("ListOfProductsServices");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
if ($massaction == 'set_default_account') {
|
||||
$formquestion[]=array('type' => 'other',
|
||||
'name' => 'set_default_account',
|
||||
'label' => $langs->trans("AccountancyCode"),
|
||||
'value' => $form->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($chk_prod)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
@@ -644,7 +664,7 @@ if ($result) {
|
||||
if (!empty($obj->aaid)) {
|
||||
$defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
}
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
// Accounting account buy intra (In EEC)
|
||||
@@ -658,7 +678,7 @@ if ($result) {
|
||||
if (!empty($obj->aaid)) {
|
||||
$defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
}
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
// Accounting account buy export (Out of EEC)
|
||||
@@ -672,7 +692,7 @@ if ($result) {
|
||||
if (!empty($obj->aaid)) {
|
||||
$defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
}
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
// Accounting account sell
|
||||
@@ -686,7 +706,7 @@ if ($result) {
|
||||
if (!empty($obj->aaid)) {
|
||||
$defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
}
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
// Accounting account sell intra (In EEC)
|
||||
@@ -700,7 +720,7 @@ if ($result) {
|
||||
if (!empty($obj->aaid)) {
|
||||
$defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
}
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print '</td>';
|
||||
} else {
|
||||
// Accounting account sell export (Out of EEC)
|
||||
@@ -713,20 +733,27 @@ if ($result) {
|
||||
if (!empty($obj->aaid)) {
|
||||
$defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
}
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($chk_prod)) {
|
||||
$ischecked = 0;
|
||||
if (in_array($product_static->id, $chk_prod)) {
|
||||
$ischecked=true;
|
||||
}
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
|
||||
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" '.($ischecked ? "checked" : "").' value="'.$obj->rowid.'"/></td>';
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_savebutton()
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
|
||||
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
||||
@@ -46,7 +47,7 @@ $search_type = GETPOST('search_type', 'int');
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->chartofaccount) {
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -367,6 +368,7 @@ if ($resql) {
|
||||
print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@@ -241,7 +241,7 @@ if ($action != 'export_csv') {
|
||||
if (empty($reshook)) {
|
||||
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#exportcsvbutton").click(function() {
|
||||
event.preventDefault();
|
||||
@@ -417,7 +417,7 @@ if ($action != 'export_csv') {
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '<td colspan="'.($colspan+1).'" class="tdforbreak">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_number;
|
||||
|
||||
@@ -512,10 +512,10 @@ if ($action == 'create') {
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Doc type
|
||||
if (!empty($object->doc_type)) {
|
||||
@@ -591,7 +591,7 @@ if ($action == 'create') {
|
||||
*/
|
||||
print "</table>\n";
|
||||
|
||||
print '</div></div><!-ee-->';
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@@ -618,9 +618,10 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n";
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">'."\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
if (count($object->linesmvt) > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
@@ -670,8 +671,14 @@ if ($action == 'create') {
|
||||
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
$accountingaccount->fetch(null, $line->numero_compte, true);
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 0).'</td>';
|
||||
$resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true);
|
||||
print '<td>';
|
||||
if ($resultfetch > 0) {
|
||||
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
|
||||
} else {
|
||||
print $line->numero_compte.' <span class="warning">('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.length_accounta($line->subledger_account);
|
||||
if ($line->subledger_label) {
|
||||
print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>';
|
||||
@@ -681,11 +688,15 @@ if ($action == 'create') {
|
||||
print '<td class="right nowraponall amount">'.price($line->debit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price($line->credit).'</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
if (empty($line->date_export) && empty($line->date_validation)) {
|
||||
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_edit('', 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
} else {
|
||||
print '<a class="editfielda nohover cursornotallowed reposition disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
|
||||
print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
}
|
||||
|
||||
if (empty($line->date_validation)) {
|
||||
@@ -696,9 +707,13 @@ if ($action == 'create') {
|
||||
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="editfielda nohover cursornotallowed disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
|
||||
print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated"));
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
@@ -733,12 +748,16 @@ if ($action == 'create') {
|
||||
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
|
||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if ($mode == '_tmp' && $action == '') {
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
@@ -753,8 +772,9 @@ if ($action == 'create') {
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
print load_fiche_titre($langs->trans("NoRecords"));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* \ingroup Accountancy (Double entries)
|
||||
* \brief List operation of book keeping
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
@@ -333,10 +334,6 @@ if (empty($reshook)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code)) {
|
||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code_start)) {
|
||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
|
||||
@@ -533,11 +530,11 @@ if (count($filter) > 0) {
|
||||
$sqlwhere[] = $key."='".$db->idate($value)."'";
|
||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||
$sqlwhere[] = $key."'".$db->idate($value)."'";
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
$sqlwhere[] = $key."'".$db->escape($value)."'";
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key.'='.((int) $value);
|
||||
} elseif ($key == 't.numero_compte') {
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
|
||||
} elseif ($key == 't.subledger_account') {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
|
||||
@@ -711,8 +711,8 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// Show the break account
|
||||
print "<tr>";
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" class="tdforbreak">';
|
||||
if ($line->numero_compte != "" && $line->numero_compte != '-1') {
|
||||
print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
|
||||
} else {
|
||||
|
||||
@@ -713,8 +713,8 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// Show the break account
|
||||
print "<tr>";
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" class="tdforbreak">';
|
||||
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
|
||||
print $line->subledger_label.' : '.length_accounta($line->subledger_account);
|
||||
} else {
|
||||
|
||||
@@ -87,11 +87,11 @@ class AccountancyExport
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB &$db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = &$db;
|
||||
$this->db = $db;
|
||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
|
||||
}
|
||||
@@ -928,17 +928,18 @@ class AccountancyExport
|
||||
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
|
||||
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
$refInvoice = '';
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
// Customer invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$invoice = new Facture($db);
|
||||
$invoice = new Facture($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref;
|
||||
} elseif ($line->doc_type == 'supplier_invoice') {
|
||||
// Supplier invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$invoice = new FactureFournisseur($db);
|
||||
$invoice = new FactureFournisseur($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref_supplier;
|
||||
@@ -1054,17 +1055,18 @@ class AccountancyExport
|
||||
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
|
||||
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
$refInvoice = '';
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
// Customer invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$invoice = new Facture($db);
|
||||
$invoice = new Facture($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref;
|
||||
} elseif ($line->doc_type == 'supplier_invoice') {
|
||||
// Supplier invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$invoice = new FactureFournisseur($db);
|
||||
$invoice = new FactureFournisseur($this->db);
|
||||
$invoice->fetch($line->fk_doc);
|
||||
|
||||
$refInvoice = $invoice->ref_supplier;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -108,6 +108,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
public $account_category;
|
||||
|
||||
/**
|
||||
* @var int Label category account
|
||||
*/
|
||||
public $account_category_label;
|
||||
|
||||
/**
|
||||
* @var int Status
|
||||
*/
|
||||
@@ -148,6 +153,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
private $accountingaccount_codetotid_cache = array();
|
||||
|
||||
|
||||
const STATUS_ENABLED = 1;
|
||||
const STATUS_DISABLED = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -166,7 +176,7 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account
|
||||
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
|
||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||
*/
|
||||
@@ -193,7 +203,8 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch rowid=".$rowid." account_number=".$account_number, LOG_DEBUG);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@@ -495,7 +506,7 @@ class AccountingAccount extends CommonObject
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$picto = 'billr';
|
||||
$picto = 'accounting_account';
|
||||
$label = '';
|
||||
|
||||
if (empty($this->labelshort) || $withcompletelabel == 1) {
|
||||
@@ -685,63 +696,36 @@ class AccountingAccount extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->loadLangs(array("users"));
|
||||
|
||||
if ($mode == 0) {
|
||||
if ($status == 1) {
|
||||
return $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 1) {
|
||||
if ($status == 1) {
|
||||
return $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 2) {
|
||||
if ($status == 1) {
|
||||
return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 3) {
|
||||
if ($status == 1) {
|
||||
return img_picto($langs->trans('Enabled'), 'statut4');
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
} elseif ($mode == 4) {
|
||||
if ($status == 1) {
|
||||
return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 5) {
|
||||
if ($status == 1) {
|
||||
return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4');
|
||||
} elseif ($status == 0) {
|
||||
return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
global $langs;
|
||||
$langs->load("users");
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
$statusType = 'status4';
|
||||
if ($status == self::STATUS_DISABLED) {
|
||||
$statusType = 'status5';
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Suggest accounting accounts to bind
|
||||
*
|
||||
* @param Societe $buyer Societe Object Buyers
|
||||
* @param $seller Company Object seller
|
||||
* @param Product $product Product object sell or buy
|
||||
* @param Facture $facture Facture
|
||||
* @param FactureLigne $factureDet Facture Det
|
||||
* @param array $accountingAccount array of Account account
|
||||
*
|
||||
* @return array Accounting accounts suggested
|
||||
* @param Societe $buyer Object buyer
|
||||
* @param Societe $seller Object seller
|
||||
* @param Product $product Product object sell or buy
|
||||
* @param Facture|FactureFournisseur $facture Facture
|
||||
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
|
||||
* @param array $accountingAccount Array of Account account
|
||||
* @param string $type Customer / Supplier
|
||||
* @return array Accounting accounts suggested
|
||||
*/
|
||||
public function getAccountingCodeToBind(Societe $buyer, $seller, Product $product, Facture $facture, FactureLigne $factureDet, $accountingAccount = array())
|
||||
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
|
||||
{
|
||||
global $conf;
|
||||
global $hookmanager;
|
||||
@@ -750,133 +734,165 @@ class AccountingAccount extends CommonObject
|
||||
$hookmanager->initHooks(array('accoutancyBindingCalculation'));
|
||||
|
||||
// Execute hook accoutancyBindingCalculation
|
||||
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount);
|
||||
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type);
|
||||
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (empty($reshook)) {
|
||||
if ($type == 'customer') {
|
||||
$const_name = "SOLD";
|
||||
} elseif ($type == 'supplier') {
|
||||
$const_name = "BUY";
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
$isBuyerInEEC = isInEEC($buyer);
|
||||
$isSellerInEEC = isInEEC($seller);
|
||||
$code_sell_l = '';
|
||||
$code_sell_p = '';
|
||||
$code_sell_t = '';
|
||||
$code_l = ''; // Default value for generic product/service
|
||||
$code_p = ''; // Value for the product/service in parameter ($product)
|
||||
$code_t = ''; // Default value of product account for the thirdparty
|
||||
$suggestedid = '';
|
||||
|
||||
// Level 1: Search suggested default account for product/service
|
||||
// Level 1 (define $code_l): Search suggested default account for product/service
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($factureDet->product_type == 1) {
|
||||
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($factureDet->product_type == 0) {
|
||||
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : '');
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'} : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($code_sell_l == -1) {
|
||||
$code_sell_l = '';
|
||||
if ($code_l == -1) {
|
||||
$code_l = '';
|
||||
}
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
|
||||
// Level 2 (define $code_p): Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code)) && !empty($product->accountancy_code_sell)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_sell_p = $product->accountancy_code_sell;
|
||||
if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code))) {
|
||||
// If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
|
||||
$code_p = $product->accountancy_code_buy;
|
||||
}
|
||||
$suggestedid = $accountingAccount['dom'];
|
||||
$suggestedaccountingaccountfor = 'prodserv';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0 && !empty($product->accountancy_code_sell)) { // European intravat sale, but with VAT
|
||||
$code_sell_p = $product->accountancy_code_sell;
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
|
||||
// European intravat sale, but with VAT
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
|
||||
$code_p = $product->accountancy_code_buy;
|
||||
}
|
||||
$suggestedid = $accountingAccount['dom'];
|
||||
$suggestedaccountingaccountfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra) && !empty($product->accountancy_code_sell)) { // European intravat sale, without VAT intra community number
|
||||
$code_sell_p = $product->accountancy_code_sell;
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
|
||||
// European intravat sale, without VAT intra community number
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
|
||||
$code_p = $product->accountancy_code_sell;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
|
||||
$code_p = $product->accountancy_code_buy;
|
||||
}
|
||||
$suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
|
||||
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) { // European intravat sale
|
||||
$code_sell_p = $product->accountancy_code_sell_intra;
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) {
|
||||
// European intravat sale
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell_intra)) {
|
||||
$code_p = $product->accountancy_code_sell_intra;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy_intra)) {
|
||||
$code_p = $product->accountancy_code_buy_intra;
|
||||
}
|
||||
$suggestedid = $accountingAccount['intra'];
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} elseif (!empty($product->accountancy_code_sell_export)) { // Foreign sale
|
||||
$code_sell_p = $product->accountancy_code_sell_export;
|
||||
} else {
|
||||
// Foreign sale
|
||||
if ($type=='customer' && !empty($product->accountancy_code_sell_export)) {
|
||||
$code_p = $product->accountancy_code_sell_export;
|
||||
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy_export)) {
|
||||
$code_p = $product->accountancy_code_buy_export;
|
||||
}
|
||||
$suggestedid = $accountingAccount['export'];
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
// Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
if (!empty($buyer->code_compta)) {
|
||||
$code_sell_t = $buyer->code_compta;
|
||||
$code_t = $buyer->code_compta;
|
||||
$suggestedid = $accountingAccount['thirdparty'];
|
||||
$suggestedaccountingaccountfor = 'thridparty';
|
||||
}
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if ($factureDet->desc == "(DEPOSIT)") {
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$code_sell_l = $accountdeposittoventilated->ref;
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
|
||||
if (empty($suggestedid) && empty($code_sell_p) && !empty($code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
|
||||
if (empty($this->accountingaccount_codetotid_cache[$code_sell_l])) {
|
||||
// If $suggestedid could not be guessed yet, we set it from the generic default accounting code $code_l
|
||||
if (empty($suggestedid) && empty($code_p) && !empty($code_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
|
||||
if (empty($this->accountingaccount_codetotid_cache[$code_l])) {
|
||||
$tmpaccount = new self($this->db);
|
||||
$result = $tmpaccount->fetch(0, $code_sell_l, 1);
|
||||
$result = $tmpaccount->fetch(0, $code_l, 1);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$this->accountingaccount_codetotid_cache[$code_sell_l] = $tmpaccount->id;
|
||||
$this->accountingaccount_codetotid_cache[$code_l] = $tmpaccount->id;
|
||||
} else {
|
||||
$suggestedid = $this->accountingaccount_codetotid_cache[$code_sell_l];
|
||||
$suggestedid = $this->accountingaccount_codetotid_cache[$code_l];
|
||||
}
|
||||
}
|
||||
return array(
|
||||
'suggestedaccountingaccountbydefaultfor' => $suggestedaccountingaccountbydefaultfor,
|
||||
'suggestedaccountingaccountfor' => $suggestedaccountingaccountfor,
|
||||
'suggestedid' => $suggestedid,
|
||||
'code_sell_l' => $code_sell_l,
|
||||
'code_sell_p' => $code_sell_p,
|
||||
'code_sell_t' => $code_sell_t,
|
||||
'code_l' => $code_l,
|
||||
'code_p' => $code_p,
|
||||
'code_t' => $code_t,
|
||||
);
|
||||
} else {
|
||||
if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
|
||||
|
||||
@@ -937,7 +937,6 @@ class BookKeeping extends CommonObject
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validated);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validation);
|
||||
|
||||
$this->lines[] = $line;
|
||||
@@ -1014,7 +1013,7 @@ class BookKeeping extends CommonObject
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->escape($value).'\'';
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
$sqlwhere[] = $key.'='.((int) $value);
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
@@ -1090,7 +1089,6 @@ class BookKeeping extends CommonObject
|
||||
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validated);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validation);
|
||||
|
||||
$this->lines[] = $line;
|
||||
@@ -1752,7 +1750,6 @@ class BookKeeping extends CommonObject
|
||||
$line->date_creation = $obj->date_creation;
|
||||
$line->date_modification = $obj->date_modification;
|
||||
$line->date_export = $obj->date_export;
|
||||
$line->date_validation = $obj->date_validated;
|
||||
$line->date_validation = $obj->date_validation;
|
||||
|
||||
$this->linesmvt[] = $line;
|
||||
@@ -1817,7 +1814,6 @@ class BookKeeping extends CommonObject
|
||||
$line->sens = $obj->sens;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_validation = $obj->date_validated;
|
||||
$line->date_validation = $obj->date_validation;
|
||||
|
||||
$this->linesexport[] = $line;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -31,7 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@@ -63,57 +64,52 @@ if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->fiscalyear->write) {
|
||||
if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) {
|
||||
$result = $object->fetchAll();
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// Specify as export : update field date_validated on selected month/year
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$db->begin();
|
||||
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
// Specify as export : update field date_validated on selected month/year
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_validated = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE entity = " . ((int) $conf->entity);
|
||||
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
||||
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " AND date_validated IS NULL";
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_validated = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
||||
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
||||
dol_syslog("/accountancy/closure/index.php action=validate_movement_confirm -> Set movements as validated", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
} else {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
}
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
@@ -43,7 +46,7 @@ if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->bind->write) {
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -73,13 +76,24 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'clean' || $action == 'validatehistory') {
|
||||
// Clean database
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
// Clean database by removing binding done on non existing or no more existing accounts
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
@@ -105,6 +119,9 @@ if ($action == 'clean' || $action == 'validatehistory') {
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||
@@ -140,14 +157,13 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell";
|
||||
}
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; // the main table
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
@@ -158,13 +174,16 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0 AND l.product_type <= 2 AND f.entity = ".((int) $conf->entity);
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
@@ -172,6 +191,8 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$num_lines = $db->num_rows($result);
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
|
||||
$isSellerInEEC = isInEEC($mysoc);
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
@@ -209,12 +230,11 @@ if ($action == 'validatehistory') {
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
$facture_static->date = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@@ -223,7 +243,7 @@ if ($action == 'validatehistory') {
|
||||
$facture_static_det->product_type = $objp->type_l;
|
||||
$facture_static_det->desc = $objp->description;
|
||||
|
||||
$accoutinAccountArray = array(
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
@@ -232,30 +252,23 @@ if ($action == 'validatehistory') {
|
||||
$code_sell_p_notset = '';
|
||||
$code_sell_t_notset = '';
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
|
||||
if (!is_array($return) && $return<0) {
|
||||
$suggestedid = 0;
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
|
||||
if (!is_array($return) && $return < 0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
$suggestedid=$return['suggestedid'];
|
||||
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
|
||||
$suggestedid = $return['suggestedid'];
|
||||
$suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor'];
|
||||
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
|
||||
$suggestedid=$return['suggestedid'];
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$suggestedid = $return['suggestedid'];
|
||||
} else {
|
||||
$suggestedid=0;
|
||||
$suggestedid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($objp->company_code_sell)) {
|
||||
$objp->code_sell_t = $objp->company_code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($objp->aarowid_suggest > 0) {
|
||||
if ($suggestedid > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
|
||||
@@ -265,18 +278,25 @@ if ($action == 'validatehistory') {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines > 10000) {
|
||||
$notpossible += ($num_lines - 10000);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +320,7 @@ print '</span><br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
@@ -314,7 +334,24 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
$cursormonth = $j;
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
if (!empty($tmp['mday'])) {
|
||||
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
|
||||
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/customer/list.php?'.$param.'">';
|
||||
}
|
||||
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
|
||||
if (!empty($tmp['mday'])) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
@@ -354,7 +391,8 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
} else {
|
||||
@@ -363,19 +401,33 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($row[$i]);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
|
||||
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr class="oddeven"><td colspan="16">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
@@ -398,7 +450,24 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
$cursormonth = $j;
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
if (!empty($tmp['mday'])) {
|
||||
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
|
||||
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php?'.$param.'">';
|
||||
}
|
||||
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
|
||||
if (!empty($tmp['mday'])) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
@@ -438,7 +507,8 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("Unknown");
|
||||
} else {
|
||||
@@ -448,20 +518,34 @@ if ($resql) {
|
||||
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($row[$i]);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
|
||||
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr class="oddeven"><td colspan="16">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
@@ -548,16 +632,22 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "(fd.total_ht-(fd.qty * fd.buy_price_ht))", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||
@@ -574,7 +664,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
} else {
|
||||
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@@ -192,10 +192,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
|
||||
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
@@ -413,6 +413,9 @@ if ($result) {
|
||||
if ($search_ref) {
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
}
|
||||
if ($search_label) {
|
||||
$param .= '&search_label='.urlencode($search_label);
|
||||
}
|
||||
if ($search_desc) {
|
||||
$param .= '&search_desc='.urlencode($search_desc);
|
||||
}
|
||||
@@ -475,7 +478,6 @@ if ($result) {
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
@@ -491,7 +493,7 @@ if ($result) {
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
@@ -525,8 +527,12 @@ if ($result) {
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
// product_type: 0 = service, 1 = product
|
||||
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$code_sell_l = '';
|
||||
$code_sell_p = '';
|
||||
$code_sell_t = '';
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
@@ -539,7 +545,7 @@ if ($result) {
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta = $objp->company_code_sell;
|
||||
$thirdpartystatic->code_compta_company = $objp->company_code_sell;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
@@ -554,12 +560,11 @@ if ($result) {
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@@ -568,7 +573,7 @@ if ($result) {
|
||||
$facture_static_det->product_type = $objp->type_l;
|
||||
$facture_static_det->desc = $objp->description;
|
||||
|
||||
$accoutinAccountArray = array(
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
@@ -577,16 +582,18 @@ if ($result) {
|
||||
$code_sell_p_notset = '';
|
||||
$code_sell_t_notset = '';
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
|
||||
$suggestedid = 0;
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
$suggestedid=$return['suggestedid'];
|
||||
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
|
||||
$suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
|
||||
$code_sell_l=$return['code_sell_l'];
|
||||
$code_sell_p=$return['code_sell_p'];
|
||||
$code_sell_t=$return['code_sell_t'];
|
||||
$code_sell_l=$return['code_l'];
|
||||
$code_sell_p=$return['code_p'];
|
||||
$code_sell_t=$return['code_t'];
|
||||
}
|
||||
//var_dump($return);
|
||||
|
||||
@@ -605,6 +612,7 @@ if ($result) {
|
||||
// $code_sell_l is now default code of product/service
|
||||
// $code_sell_p is now code of product/service
|
||||
// $code_sell_t is now code of thirdparty
|
||||
//var_dump($code_sell_l.' - '.$code_sell_p.' - '.$code_sell_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@@ -614,7 +622,7 @@ if ($result) {
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($facture_static->datef), 'day').'</td>';
|
||||
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
@@ -638,11 +646,11 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
$code_vat_differ='';
|
||||
if ($product_static->tva_tx !== $facture_static_det->tva_tx && ! empty($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
$code_vat_differ = '';
|
||||
if ($product_static->tva_tx !== $facture_static_det->tva_tx && price2num($product_static->tva_tx) && price2num($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'warning bold';
|
||||
}
|
||||
print '<td style="'.$code_vat_differ.'" class="right">';
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : ''));
|
||||
print '</td>';
|
||||
|
||||
@@ -708,12 +716,11 @@ if ($result) {
|
||||
|
||||
// Column with checkbox
|
||||
print '<td class="center">';
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
|
||||
$ischecked=1;
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
|
||||
$ischecked = 0;
|
||||
$ischecked = 0;
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$ischecked = 1;
|
||||
}
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? "checked" : "").'/>';
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@@ -731,7 +738,7 @@ if ($db->type == 'mysqli') {
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".codeventil").change(function() {
|
||||
var s=$(this).attr("id").replace("codeventil", "")
|
||||
|
||||
@@ -32,6 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
@@ -96,34 +99,69 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Now make the binding
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
|
||||
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
|
||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity);
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
|
||||
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
|
||||
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql1 .= dolSqlDateFilter('erd.date', 0, $validatemonth, $validateyear);
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (!$resql1) {
|
||||
$result = $db->query($sql1);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$num_lines = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$lineid = $objp->rowid;
|
||||
$suggestedid = $objp->suggestedid;
|
||||
|
||||
if ($suggestedid > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND rowid = ".((int) $lineid);
|
||||
|
||||
$resqlupdate = $db->query($sqlupdate);
|
||||
if (!$resqlupdate) {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines > 10000) {
|
||||
$notpossible += ($num_lines - 10000);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +184,7 @@ print '</span><br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
|
||||
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
@@ -195,7 +233,8 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
} else {
|
||||
@@ -204,15 +243,16 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($row[$i]);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
|
||||
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@@ -274,7 +314,8 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
} else {
|
||||
@@ -284,15 +325,16 @@ if ($resql) {
|
||||
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($row[$i]);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
|
||||
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -394,11 +394,12 @@ if ($result) {
|
||||
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
// Accounting account affected
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
@@ -470,7 +470,7 @@ if ($result) {
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".codeventil").change(function() {
|
||||
var s=$(this).attr("id").replace("codeventil", "")
|
||||
|
||||
@@ -100,7 +100,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
$showtutorial .= ' '.$langs->trans("ShowTutorial");
|
||||
$showtutorial .= '</a></div>';
|
||||
|
||||
$showtutorial .= '<script type="text/javascript" language="javascript">
|
||||
$showtutorial .= '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#show_hide").click(function () {
|
||||
jQuery( "#idfaq" ).toggle({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -29,10 +29,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
@@ -40,10 +44,11 @@ if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->accounting->bind->write) {
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
@@ -97,6 +102,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (!$resql1) {
|
||||
@@ -111,6 +117,9 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||
@@ -146,7 +155,6 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_buy as company_code_buy";
|
||||
}
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
@@ -163,12 +171,14 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0 AND l.product_type <= 2 AND f.entity = ".((int) $conf->entity);
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||
|
||||
@@ -181,61 +191,108 @@ if ($action == 'validatehistory') {
|
||||
|
||||
$isBuyerInEEC = isInEEC($mysoc);
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$facture_static = new FactureFournisseur($db);
|
||||
$facture_static_det = new SupplierInvoiceLine($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$isSellerInEEC = isInEEC($objp);
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta = $objp->company_code_sell;
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->status = $objp->status;
|
||||
$product_static->status_buy = $objp->status_buy;
|
||||
$product_static->accountancy_code_sell = $objp->code_sell;
|
||||
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
|
||||
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->datef = $objp->datef;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
$facture_static_det->tva_tx = $objp->tva_tx_line;
|
||||
$facture_static_det->vat_src_code = $objp->vat_src_code;
|
||||
$facture_static_det->product_type = $objp->type_l;
|
||||
$facture_static_det->desc = $objp->description;
|
||||
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
'thirdparty' =>$objp->aarowid_thirdparty);
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$code_buy_t_notset = '';
|
||||
|
||||
$suggestedid = 0;
|
||||
|
||||
$return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'supplier');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
$suggestedid = $return['suggestedid'];
|
||||
$suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor'];
|
||||
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$suggestedid = $return['suggestedid'];
|
||||
} else {
|
||||
$suggestedid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($objp->company_code_buy)) {
|
||||
$objp->code_buy_t = $objp->company_code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($objp->aarowid_suggest > 0) {
|
||||
if ($suggestedid > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid);
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
|
||||
|
||||
$resqlupdate = $db->query($sqlupdate);
|
||||
if (!$resqlupdate) {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines > 10000) {
|
||||
$notpossible += ($num_lines - 10000);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +314,7 @@ print '</span><br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
|
||||
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
@@ -272,7 +329,24 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
$cursormonth = $j;
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
if (!empty($tmp['mday'])) {
|
||||
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
|
||||
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/list.php?'.$param.'">';
|
||||
}
|
||||
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
|
||||
if (!empty($tmp['mday'])) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
@@ -307,7 +381,8 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
} else {
|
||||
@@ -316,19 +391,26 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($row[$i]);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
|
||||
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr class="oddeven"><td colspan="16">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
@@ -351,7 +433,24 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
$cursormonth = $j;
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
if (!empty($tmp['mday'])) {
|
||||
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
|
||||
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/lines.php?'.$param.'">';
|
||||
}
|
||||
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
|
||||
if (!empty($tmp['mday'])) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
@@ -386,7 +485,8 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("Unknown");
|
||||
} else {
|
||||
@@ -395,19 +495,26 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($row[$i]);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
|
||||
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr class="oddeven"><td colspan="16">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
@@ -46,6 +46,7 @@ $massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
@@ -97,10 +98,7 @@ if (!$sortorder) {
|
||||
$hookmanager->initHooks(array('accountancysupplierlist'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
@@ -293,7 +291,7 @@ if (strlen(trim($search_ref))) {
|
||||
$sql .= natural_search("p.ref", $search_ref);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= natural_search("f.libelle", $search_label);
|
||||
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= natural_search("l.description", $search_desc);
|
||||
@@ -522,20 +520,21 @@ if ($result) {
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$facturefourn_static = new FactureFournisseur($db);
|
||||
$facturefourn_static_det = new SupplierInvoiceLine($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
$isBuyerInEEC = isInEEC($mysoc);
|
||||
|
||||
$accountingaccount_codetotid_cache = array();
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
// product_type: 0 = service ? 1 = product
|
||||
// product_type: 0 = service, 1 = product
|
||||
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$objp->code_buy_l = '';
|
||||
$objp->code_buy_p = '';
|
||||
$code_buy_l = '';
|
||||
$code_buy_p = '';
|
||||
$code_buy_t = '';
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
@@ -547,6 +546,8 @@ if ($result) {
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta_company = $objp->company_code_buy;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
@@ -560,95 +561,66 @@ if ($result) {
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facturefourn_static->ref = $objp->ref;
|
||||
$facturefourn_static->id = $objp->facid;
|
||||
$facturefourn_static->type = $objp->ftype;
|
||||
$facturefourn_static->label = $objp->invoice_label;
|
||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||
|
||||
$facturefourn_static_det->id = $objp->rowid;
|
||||
$facturefourn_static_det->total_ht = $objp->total_ht;
|
||||
$facturefourn_static_det->tva_tx = $objp->tva_tx_line;
|
||||
$facturefourn_static_det->vat_src_code = $objp->vat_src_code;
|
||||
$facturefourn_static_det->product_type = $objp->type_l;
|
||||
$facturefourn_static_det->desc = $objp->description;
|
||||
|
||||
$accountingAccountArray = array(
|
||||
'dom'=>$objp->aarowid,
|
||||
'intra'=>$objp->aarowid_intra,
|
||||
'export'=>$objp->aarowid_export,
|
||||
'thirdparty' =>$objp->aarowid_thirdparty);
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$code_buy_t_notset = '';
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isSellerInEEC = isInEEC($objp);
|
||||
$suggestedid = 0;
|
||||
|
||||
// Level 1: Search suggested default account for product/service
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($objp->type_l == 0) {
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->code_sell_l == -1) {
|
||||
$objp->code_sell_l = '';
|
||||
}
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
$return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier');
|
||||
if (!is_array($return) && $return<0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
$suggestedid=$return['suggestedid'];
|
||||
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
|
||||
$suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
|
||||
$code_buy_l=$return['code_l'];
|
||||
$code_buy_p=$return['code_p'];
|
||||
$code_buy_t=$return['code_t'];
|
||||
}
|
||||
//var_dump($return);
|
||||
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
if (!empty($objp->company_code_buy)) {
|
||||
$objp->code_buy_t = $objp->company_code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($objp->code_buy_p)) {
|
||||
if (!empty($code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) {
|
||||
if (empty($code_buy_l) && empty($code_buy_p)) {
|
||||
$code_buy_p_notset = 'color:red';
|
||||
}
|
||||
/*if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
|
||||
$code_sell_p_notset = 'color:orange';
|
||||
}*/
|
||||
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_t is now code of thirdparty
|
||||
// $code_buy_l is now default code of product/service
|
||||
// $code_buy_p is now code of product/service
|
||||
// $code_buy_t is now code of thirdparty
|
||||
//var_dump($code_buy_l.' - '.$code_buy_p.' - '.$code_buy_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Line id
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
print '<td>'.$facturefourn_static_det->id.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
||||
@@ -658,23 +630,23 @@ if ($result) {
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
|
||||
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if ($product_static->id > 0) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
if ($objp->product_label) {
|
||||
print '<br><span class="opacitymedium small">'.$objp->product_label.'</span>';
|
||||
if ($product_static->label) {
|
||||
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
@@ -682,11 +654,12 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p && ! empty($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
$code_vat_differ = '';
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'warning bold';
|
||||
}
|
||||
print '<td style="'.$code_vat_differ.'" class="right">';
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : ''));
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
|
||||
print '</td>';
|
||||
|
||||
// Thirdparty
|
||||
@@ -703,26 +676,31 @@ if ($result) {
|
||||
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
|
||||
$shelp .= $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
if ($objp->product_id > 0) {
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = '';
|
||||
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
|
||||
$shelp = $langs->trans("SaleEECWithVAT");
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
|
||||
$shelp = $langs->trans("SaleEECWithoutVATNumber");
|
||||
$ttype = 'warning';
|
||||
} elseif ($suggestedaccountingaccountfor == 'export') {
|
||||
$shelp = $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= (empty($objp->code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_buy_p));
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
$s .= (empty($code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($code_buy_p));
|
||||
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
|
||||
} else {
|
||||
print '<br>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
@@ -732,35 +710,25 @@ if ($result) {
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<br>';
|
||||
$s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
|
||||
$s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
|
||||
$shelp = '';
|
||||
$s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
$s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
$suggestedid = $objp->aarowid_suggest;
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
|
||||
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l])) {
|
||||
$tmpaccount = new AccountingAccount($db);
|
||||
$tmpaccount->fetch(0, $objp->code_buy_l, 1);
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
|
||||
} else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
|
||||
}
|
||||
}
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Column with checkbox
|
||||
print '<td class="center">';
|
||||
$ischecked = $objp->aarowid_suggest;
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="'.$objp->rowid."_".$i.'"'.($ischecked ? "checked" : "").'/>';
|
||||
$ischecked = 0;
|
||||
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
|
||||
$ischecked = 1;
|
||||
}
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@@ -779,7 +747,7 @@ if ($db->type == 'mysqli') {
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".codeventil").change(function() {
|
||||
var s=$(this).attr("id").replace("codeventil", "")
|
||||
|
||||
@@ -228,7 +228,7 @@ print "</td></tr>\n";
|
||||
// Allow members to change type on renewal forms
|
||||
/* To test during next beta
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
|
||||
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
|
||||
print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
|
||||
print "</td></tr>\n";
|
||||
*/
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initemail()
|
||||
{
|
||||
@@ -265,7 +265,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
|
||||
print '<div class="urllink">';
|
||||
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
|
||||
print '<a target="_blank" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
|
||||
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
|
||||
print '</div>';
|
||||
print ajax_autoselect('publicurlmember');
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class ActionsAdherentCardCommon
|
||||
|
||||
if ($action == 'create' || $action == 'edit') {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
|
||||
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="'.$action.'";
|
||||
|
||||
@@ -327,7 +327,7 @@ if (empty($reshook)) {
|
||||
$object->public = GETPOST("public", 'alpha');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
@@ -928,20 +928,20 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id;
|
||||
$object->country_id = GETPOST('country_id', 'int') ? GETPOST('country_id', 'int') : $mysoc->country_id;
|
||||
if ($object->country_id) {
|
||||
$tmparray = getCountry($object->country_id, 'all');
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
$soc = new Societe($db);
|
||||
if (!empty($socid)) {
|
||||
$object = new Societe($db);
|
||||
if ($socid > 0) {
|
||||
$object->fetch($socid);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
if (!($object->id > 0)) {
|
||||
if (!($soc->id > 0)) {
|
||||
$langs->load("errors");
|
||||
print($langs->trans('ErrorRecordNotFound'));
|
||||
exit;
|
||||
@@ -953,7 +953,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print load_fiche_titre($langs->trans("NewMember"), '', $object->picto);
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
@@ -1024,7 +1024,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $object->company).'"></td></tr>';
|
||||
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET('societe') ? GETPOST('societe', 'alphanohtml') : $soc->name).'"></td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
@@ -1048,7 +1048,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? '<span class="fieldrequired">' : '').$langs->trans("EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? '</span>' : '').'</td>';
|
||||
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
|
||||
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $soc->email).'"></td></tr>';
|
||||
|
||||
// Website
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', '', $object, 0).'</td>';
|
||||
@@ -1056,21 +1056,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $soc->address).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $soc->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $soc->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
|
||||
if (empty($soc->country_id)) {
|
||||
$soc->country_id = $mysoc->country_id;
|
||||
$soc->country_code = $mysoc->country_code;
|
||||
$soc->state_id = $mysoc->state_id;
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
||||
print img_picto('', 'country', 'class="pictofixedwidth"');
|
||||
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
|
||||
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $soc->country_id, 'country_id');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
@@ -1079,9 +1083,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// State
|
||||
if (empty($conf->global->MEMBER_DISABLE_STATE)) {
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($object->country_id) {
|
||||
if ($soc->country_id) {
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
|
||||
print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $soc->state_id, $soc->country_code);
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
@@ -1090,7 +1094,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Pro phone
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
|
||||
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
|
||||
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $soc->phone).'"></td></tr>';
|
||||
|
||||
// Personal phone
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
|
||||
@@ -1179,7 +1183,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
@@ -1779,18 +1783,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield tableforfield centpercent">';
|
||||
|
||||
// Birth Date
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||
|
||||
// Categories
|
||||
// Tags / Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
@@ -1798,6 +1796,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Birth Date
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@@ -1868,7 +1872,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div></div>\n";
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
@@ -2012,7 +2016,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Generated documents
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
//$filename = 'tmp_cards.php';
|
||||
$filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed = $user->rights->adherent->lire;
|
||||
@@ -2042,20 +2045,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
$MAX = 10;
|
||||
|
||||
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id.'">';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlright);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlcenter);
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
|
||||
@@ -39,6 +39,7 @@ $day = dol_print_date($now, '%d');
|
||||
$foruserid = GETPOST('foruserid', 'alphanohtml');
|
||||
$foruserlogin = GETPOST('foruserlogin', 'alphanohtml');
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$modelcard = GETPOST("modelcard", 'aZ09'); // Doc template to use for business cards
|
||||
$model = GETPOST("model", 'aZ09'); // Doc template to use for business cards
|
||||
$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
|
||||
$mesg = '';
|
||||
@@ -84,10 +85,10 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if (is_numeric($foruserid)) {
|
||||
$sql .= " AND d.rowid=".(int) $foruserid;
|
||||
$sql .= " AND d.rowid = ".(int) $foruserid;
|
||||
}
|
||||
if ($foruserlogin) {
|
||||
$sql .= " AND d.login='".$db->escape($foruserlogin)."'";
|
||||
$sql .= " AND d.login = '".$db->escape($foruserlogin)."'";
|
||||
}
|
||||
$sql .= " ORDER BY d.rowid ASC";
|
||||
|
||||
@@ -118,7 +119,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
}
|
||||
//if (!empty($objp->$key))
|
||||
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', $object->table_element); //$objp->$tmpkey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +144,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
'__MONTH__'=>$month,
|
||||
'__DAY__'=>$day,
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
'__SERVER__'=>"https://".$_SERVER["SERVER_NAME"]."/"
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||
|
||||
@@ -155,7 +156,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
|
||||
|
||||
if (is_numeric($foruserid) || $foruserlogin) {
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; // $_Avery_Labels is defined into an include
|
||||
if ($nb <= 0) {
|
||||
$nb = 1; // Protection to avoid empty page
|
||||
}
|
||||
@@ -209,7 +210,19 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
}
|
||||
|
||||
// Build and output PDF
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
|
||||
$outputlangs = $langs;
|
||||
|
||||
if (empty($mode) || $mode == 'card') {
|
||||
if (!count($arrayofmembers)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
if (empty($modelcard) || $modelcard == '-1') {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
|
||||
}
|
||||
if (!$mesg) {
|
||||
$result = members_card_pdf_create($db, $arrayofmembers, $modelcard, $outputlangs, '', 'standard', 'tmp_cards');
|
||||
}
|
||||
} elseif ($mode == 'cardlogin') {
|
||||
if (!count($arrayofmembers)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
@@ -217,7 +230,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
|
||||
}
|
||||
if (!$mesg) {
|
||||
$result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
|
||||
$result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs, '', 'standard', 'tmp_cards_login');
|
||||
}
|
||||
} elseif ($mode == 'label') {
|
||||
if (!count($arrayofmembers)) {
|
||||
@@ -275,7 +288,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">';
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
* Copyright (C) 2021 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -1397,6 +1398,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->photo = $obj->photo;
|
||||
$this->statut = $obj->statut;
|
||||
$this->status = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
@@ -1520,7 +1522,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
|
||||
|
||||
$this->partnerships[] = array();
|
||||
@@ -2338,12 +2340,12 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} elseif ($status == self::STATUS_RESILIATED) {
|
||||
$statusType = 'status6';
|
||||
$labelStatus = $langs->trans("MemberStatusResiliated");
|
||||
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
|
||||
$labelStatus = $langs->transnoentitiesnoconv("MemberStatusResiliated");
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv("MemberStatusResiliatedShort");
|
||||
} elseif ($status == self::STATUS_EXCLUDED) {
|
||||
$statusType = 'status10';
|
||||
$labelStatus = $langs->trans("MemberStatusExcluded");
|
||||
$labelStatusShort = $langs->trans("MemberStatusExcludedShort");
|
||||
$labelStatus = $langs->transnoentitiesnoconv("MemberStatusExcluded");
|
||||
$labelStatusShort = $langs->transnoentitiesnoconv("MemberStatusExcludedShort");
|
||||
}
|
||||
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
@@ -2703,7 +2705,7 @@ class Adherent extends CommonObject
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
|
||||
}
|
||||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
|
||||
}
|
||||
} elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') {
|
||||
// Set LDAP password if possible
|
||||
@@ -2714,7 +2716,7 @@ class Adherent extends CommonObject
|
||||
if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||
// Create OpenLDAP MD5 password from Dolibarr MD5 password
|
||||
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dolGetLdapPasswordHash($this->pass_indatabase_crypted, 'md5frommd5');
|
||||
}
|
||||
}
|
||||
} elseif (!empty($this->pass_indatabase)) {
|
||||
@@ -2723,7 +2725,7 @@ class Adherent extends CommonObject
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
|
||||
}
|
||||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class AdherentType extends CommonObject
|
||||
public $subscription;
|
||||
|
||||
/**
|
||||
* @var float amount for subscription
|
||||
* @var float|string Amount for subscription (null or '' means not defined)
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
@@ -543,14 +543,13 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of amount by type id
|
||||
* Return the array of all amounts per membership type id
|
||||
*
|
||||
* @param int $status Filter on status of type
|
||||
* @return array List of types of members
|
||||
* @return array Array of membership type
|
||||
*/
|
||||
public function amountByType($status = null)
|
||||
{
|
||||
|
||||
global $conf, $langs;
|
||||
|
||||
$amountbytype = array();
|
||||
@@ -578,6 +577,7 @@ class AdherentType extends CommonObject
|
||||
} else {
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
return $amountbytype;
|
||||
}
|
||||
|
||||
@@ -737,10 +737,10 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
$this->labelStatus[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatus[1] = $langs->trans("InActivity");
|
||||
$this->labelStatusShort[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatusShort[1] = $langs->trans("InActivity");
|
||||
$this->labelStatus[0] = $langs->transnoentitiesnoconv("ActivityCeased");
|
||||
$this->labelStatus[1] = $langs->transnoentitiesnoconv("InActivity");
|
||||
$this->labelStatusShort[0] = $langs->transnoentitiesnoconv("ActivityCeased");
|
||||
$this->labelStatusShort[1] = $langs->transnoentitiesnoconv("InActivity");
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
|
||||
@@ -70,7 +70,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$this->where .= " m.statut != -1";
|
||||
$this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
|
||||
if ($this->memberid) {
|
||||
$this->where .= " AND m.rowid = ".((int) $this->memberid);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -111,7 +111,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
@@ -132,7 +132,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -153,7 +153,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -174,7 +174,7 @@ class AdherentStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
@@ -36,7 +36,7 @@ $sortorder = GETPOST('sortorder', 'aZ09');
|
||||
if (empty($conf->adherent->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->rights->adherent->export) {
|
||||
if (empty($user->rights->adherent->export)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -50,14 +50,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
$canadduser = (!empty($user->admin) || !empty($user->rights->user->user->creer));
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $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)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer))
|
||||
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->creer)));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->password)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,17 +135,17 @@ $adht->fetch($object->typeid);
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// LDAP DN
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.getDolGlobalString('LDAP_MEMBER_DN')."</td></tr>\n";
|
||||
|
||||
// LDAP Cle
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_MEMBERS."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.getDolGlobalString('LDAP_KEY_MEMBERS')."</td></tr>\n";
|
||||
|
||||
// LDAP Server
|
||||
print '<tr><td>LDAP '.$langs->trans("Type").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_TYPE."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("Version").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PROTOCOLVERSION."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("Type").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_TYPE')."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("Version").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION')."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_HOST')."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_HOST_SLAVE')."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_PORT')."</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -158,13 +158,13 @@ print dol_get_fiche_end();
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalString('LDAP_MEMBER_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
|
||||
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalString('LDAP_MEMBER_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ if (!empty($search_categ) || !empty($catid)) {
|
||||
}
|
||||
$sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
|
||||
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
|
||||
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
|
||||
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
|
||||
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
|
||||
$sql .= " d.note_private, d.note_public,";
|
||||
$sql .= " s.nom,";
|
||||
@@ -962,7 +962,7 @@ while ($i < min($num, $limit)) {
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">';
|
||||
print $memberstatic->getNomUrl(0, 0, 'card', 'fistname');
|
||||
print $memberstatic->getNomUrl(0, 0, 'card', 'firstname');
|
||||
//print $obj->firstname;
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
|
||||
@@ -161,40 +161,40 @@ if ($mode) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($mode == 'memberbycountry') {
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'code'=>$obj->code,
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'code'=>$obj->code,
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbyregion') { //+
|
||||
$data[] = array(
|
||||
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
|
||||
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label :'<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbystate') {
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbytown') {
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -195,9 +195,7 @@ foreach ($data as $val) {
|
||||
}
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td class="center">';
|
||||
//print '<a href="month.php?year='.$year.'">';
|
||||
print $year;
|
||||
//print '</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?date_select='.((int) $year).'">'.$year.'</a>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
print '<td class="right amount nowraponall"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
||||
@@ -210,7 +208,7 @@ print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
@@ -225,7 +223,7 @@ if ($mesg) {
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
|
||||
@@ -557,10 +557,10 @@ if ($rowid > 0) {
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Birthday
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
@@ -652,7 +652,7 @@ if ($rowid > 0) {
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div></div>\n";
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
@@ -838,7 +838,7 @@ if ($rowid > 0) {
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
//var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ? 'show()' : 'hide()').';
|
||||
$("#none, #invoiceonly").click(function() {
|
||||
@@ -943,8 +943,10 @@ if ($rowid > 0) {
|
||||
}
|
||||
if (!$datefrom) {
|
||||
$datefrom = $object->datevalid;
|
||||
if ($object->datefin > 0) {
|
||||
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
|
||||
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||
} else {
|
||||
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));
|
||||
}
|
||||
}
|
||||
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
|
||||
@@ -963,7 +965,7 @@ if ($rowid > 0) {
|
||||
|
||||
if ($adht->subscription) {
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'. price(GETPOSTISSET('subscription') ? GETPOST('subscription') : $adht->amount).'"> '.$langs->trans("Currency".$conf->currency) .'</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td>';
|
||||
|
||||
@@ -48,7 +48,7 @@ $note = GETPOST('note', 'alpha');
|
||||
$typeid = (int) GETPOST('typeid', 'int');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (!$user->rights->adherent->cotisation->lire) {
|
||||
if (empty($user->rights->adherent->cotisation->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ $permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the i
|
||||
$hookmanager->initHooks(array('subscriptioncard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
|
||||
$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
|
||||
|
||||
|
||||
/*
|
||||
@@ -388,7 +388,7 @@ if ($rowid && $action != 'edit') {
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
*/
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
@@ -397,7 +397,7 @@ if ($rowid && $action != 'edit') {
|
||||
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "members", "bills", "users"));
|
||||
|
||||
if (!$user->rights->adherent->lire) {
|
||||
if (empty($user->rights->adherent->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -311,6 +311,7 @@ print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="date_select" value="'.$date_select.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
|
||||
@@ -35,7 +35,7 @@ $total = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
echo '<tr class="oddeven">';
|
||||
echo '<td>'.$langs->trans("Subscription").'</td>';
|
||||
echo '<td>'.$objectlink->getNomUrl(1).'</td>';
|
||||
echo '<td class="nowraponall">'.$objectlink->getNomUrl(1).'</td>';
|
||||
echo '<td class="center"></td>';
|
||||
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
|
||||
echo '<td class="right">';
|
||||
|
||||
@@ -180,7 +180,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
||||
$object->vote = (boolean) trim($vote);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@@ -124,13 +124,13 @@ print dol_get_fiche_end();
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
|
||||
if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
|
||||
if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
@@ -170,7 +170,6 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
@@ -76,11 +76,11 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
|
||||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = GETPOST("libelle", 'alphanohtml');
|
||||
$object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
|
||||
$object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
//$object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = GETPOST("libelle", 'alphanohtml');
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
|
||||
$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
//$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
|
||||
}
|
||||
|
||||
// backup into database
|
||||
|
||||
@@ -94,13 +94,13 @@ $formcompany = new FormCompany($db);
|
||||
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</span>';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
/**
|
||||
* Edit parameters
|
||||
*/
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function() {
|
||||
document.form_index.action.value="updateedit";
|
||||
@@ -115,7 +115,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
@@ -157,7 +157,7 @@ print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input name="mail" id="email" class="maxwidth150 widthcentpercentminusx" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
|
||||
print '<input name="mail" id="email" class="maxwidth300 widthcentpercentminusx" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
|
||||
@@ -83,26 +83,26 @@ if ($action == 'set') {
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$defaultValues = new DefaultValues($db);
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
if (!is_array($result) && $result<0) {
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
if (!is_array($result) && $result < 0) {
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
} elseif (count($result)>0) {
|
||||
} elseif (count($result) > 0) {
|
||||
foreach ($result as $defval) {
|
||||
$defaultValues->id=$defval->id;
|
||||
$defaultValues->id = $defval->id;
|
||||
$resultDel = $defaultValues->delete($user);
|
||||
if ($resultDel<0) {
|
||||
if ($resultDel < 0) {
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
$defaultValues->type='createform';
|
||||
$defaultValues->entity=$conf->entity;
|
||||
$defaultValues->user_id=0;
|
||||
$defaultValues->page='comm/action/card.php';
|
||||
$defaultValues->param='complete';
|
||||
$defaultValues->value=GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
|
||||
$resultCreat=$defaultValues->create($user);
|
||||
if ($resultCreat<0) {
|
||||
$defaultValues->type = 'createform';
|
||||
$defaultValues->entity = $conf->entity;
|
||||
$defaultValues->user_id = 0;
|
||||
$defaultValues->page = 'comm/action/card.php';
|
||||
$defaultValues->param = 'complete';
|
||||
$defaultValues->value = GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
|
||||
$resultCreat = $defaultValues->create($user);
|
||||
if ($resultCreat < 0) {
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'specimen') { // For orders
|
||||
@@ -355,13 +355,13 @@ print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right nowrap">'."\n";
|
||||
$defval='na';
|
||||
$defval = 'na';
|
||||
$defaultValues = new DefaultValues($db);
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
if (!is_array($result) && $result<0) {
|
||||
$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity));
|
||||
if (!is_array($result) && $result < 0) {
|
||||
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
|
||||
} elseif (count($result)>0) {
|
||||
$defval=reset($result)->value;
|
||||
} elseif (count($result) > 0) {
|
||||
$defval = reset($result)->value;
|
||||
}
|
||||
$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@@ -159,7 +159,7 @@ $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : "");
|
||||
// Show message
|
||||
$message = '';
|
||||
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
@@ -168,7 +168,7 @@ $message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl1');
|
||||
$message .= '<br>';
|
||||
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
@@ -177,7 +177,7 @@ $message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl2');
|
||||
$message .= '<br>';
|
||||
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'rss', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
|
||||
@@ -275,8 +275,7 @@ print '<br><br>';
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
//{
|
||||
|
||||
print load_fiche_titre($langs->trans("BankAccountModelModule"), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
@@ -466,8 +465,7 @@ print '<br><br>';
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
//{
|
||||
|
||||
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
|
||||
@@ -176,6 +176,71 @@ foreach ($dirbarcode as $reldir) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Select barcode numbering module
|
||||
if ($conf->product->enabled) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCode = new $file();
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
|
||||
print $modBarCode->info($langs);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
$s = $modBarCode->getToolTip($langs, null, -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CHOIX ENCODAGE
|
||||
*/
|
||||
@@ -189,6 +254,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="hidden" name="action" value="updateengine">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
@@ -211,8 +277,9 @@ if ($resql) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print $obj->label;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="100">';
|
||||
print dol_escape_htmltag($obj->label);
|
||||
print "</td><td>\n";
|
||||
print $langs->trans('BarcodeDesc'.$obj->encoding);
|
||||
//print "L'EAN se compose de 8 caracteres, 7 chiffres plus une cle de controle.<br>";
|
||||
@@ -270,6 +337,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
@@ -287,6 +355,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
@@ -304,7 +373,9 @@ if (!isset($_SERVER['WINDIR'])) {
|
||||
$langs->load("errors");
|
||||
print '<br><span class="error">'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Module products
|
||||
@@ -313,7 +384,9 @@ if (!empty($conf->product->enabled)) {
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1);
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Module thirdparty
|
||||
@@ -322,10 +395,14 @@ if (!empty($conf->societe->enabled)) {
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1);
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<input type="submit" class="button" name="submit_GENBARCODE_BARCODETYPE_THIRDPARTY" value="'.$langs->trans("Modify").'">';
|
||||
print "</div>";
|
||||
@@ -334,71 +411,6 @@ print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
// Select barcode numbering module
|
||||
if ($conf->product->enabled) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCode = new $file();
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
|
||||
print $modBarCode->info($langs);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
$s = $modBarCode->getToolTip($langs, null, -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
//print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -175,9 +175,9 @@ if ($action == 'switch') {
|
||||
$newfirst = $objto->box_order;
|
||||
$newsecond = $objfrom->box_order;
|
||||
if ($newfirst == $newsecond) {
|
||||
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
|
||||
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
|
||||
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
|
||||
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
|
||||
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
|
||||
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
|
||||
@@ -300,14 +300,13 @@ $boxtoadd = InfoBox::listBoxes($db, 'available', -1, null, $actives);
|
||||
// Activated boxes
|
||||
$boxactivated = InfoBox::listBoxes($db, 'activated', -1, null);
|
||||
|
||||
print "<br>\n";
|
||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||
print load_fiche_titre($langs->trans("BoxesAvailable"), '', '');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||
print '<input type="hidden" name="action" value="add">'."\n";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="tagtable liste centpercent">'."\n";
|
||||
|
||||
@@ -315,9 +314,12 @@ print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Box").'</td>';
|
||||
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td width="160" class="center">'.$langs->trans("ActivatableOn").'</td>';
|
||||
print "</tr>\n";
|
||||
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
|
||||
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||
foreach ($boxtoadd as $box) {
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
|
||||
$logo = $box->boximg;
|
||||
@@ -326,8 +328,8 @@ foreach ($boxtoadd as $box) {
|
||||
}
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
print '<tr class="oddeven" style="height:3em !important;">'."\n";
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv($box->boxlabel)).'">'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
|
||||
print img_picto('', 'graph', 'class="paddingleft"');
|
||||
}
|
||||
@@ -339,7 +341,7 @@ foreach ($boxtoadd as $box) {
|
||||
}
|
||||
}
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note).'">';
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("WarningUsingThisBoxSlowDown");
|
||||
@@ -357,36 +359,21 @@ foreach ($boxtoadd as $box) {
|
||||
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans("Activate").'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
if (!count($boxtoadd) && count($boxactivated)) {
|
||||
print '<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans("AllWidgetsWereEnabled").'</span></td></tr>';
|
||||
}
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
print '<div class="right">';
|
||||
print '<input type="submit" class="button"'.(count($boxtoadd) ? '' : ' disabled').' value="'.$langs->trans("Activate").'">';
|
||||
print '</div>'."\n";
|
||||
print '</form>';
|
||||
print "\n".'<!-- End Boxes Available -->'."\n";
|
||||
|
||||
|
||||
//var_dump($boxactivated);
|
||||
print "<br>\n\n";
|
||||
print load_fiche_titre($langs->trans("BoxesActivated"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="tagtable liste">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Box").'</td>';
|
||||
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
||||
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
|
||||
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$box_order = 1;
|
||||
$foundrupture = 1;
|
||||
foreach ($boxactivated as $key => $box) {
|
||||
@@ -397,8 +384,8 @@ foreach ($boxactivated as $key => $box) {
|
||||
}
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
print '<tr class="oddeven" style="height:3em !important;">';
|
||||
print '<td>'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
|
||||
print img_picto('', 'graph', 'class="paddingleft"');
|
||||
}
|
||||
@@ -410,14 +397,17 @@ foreach ($boxactivated as $key => $box) {
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$langs->load("errors");
|
||||
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note == '(WarningUsingThisBoxSlowDown)' ? $langs->trans("WarningUsingThisBoxSlowDown") : $box->note).'">';
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
$langs->load("errors");
|
||||
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
|
||||
} else {
|
||||
print ($box->note ? $box->note : ' ');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->textwithpicto('', $langs->trans("SourceFile").' : '.$box->sourcefile);
|
||||
print '</td>'."\n";
|
||||
print '<td class="center">'.(empty($arrayofhomepages[$box->position]) ? '' : $langs->trans($arrayofhomepages[$box->position])).'</td>';
|
||||
$hasnext = ($key < (count($boxactivated) - 1));
|
||||
$hasprevious = ($key != 0);
|
||||
@@ -437,6 +427,8 @@ print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Other parameters
|
||||
|
||||
|
||||
@@ -378,14 +378,13 @@ $head = company_admin_prepare_head();
|
||||
print dol_get_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
/**
|
||||
* Edit parameters
|
||||
*/
|
||||
// Edit parameters
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#selectcountry_id").change(function() {
|
||||
document.form_index.action.value="updateedit";
|
||||
@@ -418,7 +417,7 @@ print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->tra
|
||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
|
||||
|
||||
// Country
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td>';
|
||||
print img_picto('', 'globe-americas', 'class="pictofixedwidth"');
|
||||
print $form->select_country($mysoc->country_id, 'country_id', '', 0);
|
||||
if ($user->admin) {
|
||||
@@ -426,14 +425,14 @@ if ($user->admin) {
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||
print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">'.$langs->trans("State").'</label></td><td>';
|
||||
$state_id = 0;
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE)) {
|
||||
$tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
|
||||
$state_id = $tmp[0];
|
||||
}
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id');
|
||||
print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id', 'maxwidth200onsmartphone minwidth300');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Currency
|
||||
@@ -457,7 +456,7 @@ print '</td></tr>'."\n";
|
||||
// Email
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="maxwidth150" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
|
||||
print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
@@ -483,7 +482,7 @@ print '</div>';
|
||||
if (!empty($mysoc->logo_small)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
|
||||
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
|
||||
print '</div>';
|
||||
} elseif (!empty($mysoc->logo)) {
|
||||
if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
|
||||
@@ -495,14 +494,14 @@ if (!empty($mysoc->logo_small)) {
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
print '</div>';
|
||||
} elseif (!empty($mysoc->logo)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
|
||||
print '</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
@@ -520,7 +519,7 @@ print '</div>';
|
||||
if (!empty($mysoc->logo_squarred_small)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
|
||||
print '</div>';
|
||||
} elseif (!empty($mysoc->logo_squarred)) {
|
||||
if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
|
||||
@@ -528,16 +527,16 @@ if (!empty($mysoc->logo_squarred_small)) {
|
||||
}
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality);
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} elseif (!empty($mysoc->logo_squarred)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
|
||||
print '</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
|
||||
@@ -104,13 +104,14 @@ print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
// Social networks
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
|
||||
print '<td class="titlefieldcreate">'.$langs->trans("SocialNetworksInformation").'</td>';
|
||||
print '<td>'.$langs->trans("SocialNetworkId").'</td>';
|
||||
print '<td>'.$form->textwithpicto($langs->trans("Url"), $langs->trans("KeepEmptyToUseDefault")).'</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@@ -121,9 +122,9 @@ foreach ($listofnetworks as $key => $value) {
|
||||
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
|
||||
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
|
||||
print '<td class="nowraponall"><span class="fa paddingright '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>';
|
||||
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
|
||||
print '</td><td>';
|
||||
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.(!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : '').'">';
|
||||
print '</td><td>';
|
||||
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
|
||||
print '</td>';
|
||||
print '<td class="nowraponall">'.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).'</td>';
|
||||
print '</tr>'."\n";
|
||||
@@ -133,7 +134,6 @@ foreach ($listofnetworks as $key => $value) {
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ if ($result) {
|
||||
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>'.$obj->name.'</td>'."\n";
|
||||
print '<tr class="oddeven" data-checkbox-id="check_'.$i.'"><td>'.$obj->name.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
|
||||
@@ -123,12 +123,12 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven"><td class="titlefieldmiddle">';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
$label = $langs->trans($key);
|
||||
if ($key == 'DAV_RESTICT_ON_IP') {
|
||||
$label = $langs->trans("RESTRICT_ON_IP");
|
||||
$label .= ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
|
||||
$label .= ' <span class="opacitymedium">'.$langs->trans("Example").': '.$langs->trans("IPListExample").'</span>';
|
||||
}
|
||||
print $form->textwithpicto($label, $tooltiphelp);
|
||||
print '</td><td>';
|
||||
@@ -173,11 +173,11 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
|
||||
|
||||
// Show message
|
||||
$message = '';
|
||||
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>';
|
||||
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank" rel="noopener noreferrer">'.$urlwithroot.'/dav/fileserver.php</a>';
|
||||
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV', ''));
|
||||
$message .= '<div class="urllink"><input type="text" id="webdavpublicurl" class="quatrevingtpercent" value="'.$urlwithroot.'/dav/fileserver.php">';
|
||||
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">';
|
||||
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank" rel="noopener noreferrer">';
|
||||
$message .= ' '.img_picto('', 'globe');
|
||||
$message .= '</a>';
|
||||
$message .= '</div>';
|
||||
@@ -186,11 +186,11 @@ $message .= ajax_autoselect('webdavpublicurl');
|
||||
$message .= '<br>';
|
||||
if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) {
|
||||
$urlEntity = (!empty($conf->multicompany->enabled) ? '?entity='.$conf->entity : '');
|
||||
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
|
||||
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank" rel="noopener noreferrer">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
|
||||
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV public', ''));
|
||||
$message .= '<div class="urllink"><input type="text" id="webdavurl" class="quatrevingtpercent" value="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'">';
|
||||
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">';
|
||||
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank" rel="noopener noreferrer">';
|
||||
$message .= ' '.img_picto('', 'globe');
|
||||
$message .= '</a>';
|
||||
$message .= '</div>';
|
||||
|
||||
@@ -350,17 +350,15 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
}
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
print '</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$result=$object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
|
||||
|
||||
if (!is_array($result) && $result<0) {
|
||||
if (!is_array($result) && $result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} elseif (count($result)>0) {
|
||||
foreach ($result as $key=>$defaultvalue) {
|
||||
print "\n";
|
||||
|
||||
} elseif (is_array($result) && count($result) > 0) {
|
||||
foreach ($result as $key => $defaultvalue) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Page
|
||||
@@ -378,11 +376,6 @@ if (!is_array($result) && $result<0) {
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory') {
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($defaultvalue->value).'">';
|
||||
print '</td>';
|
||||
@@ -405,8 +398,6 @@ if (!is_array($result) && $result<0) {
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
@@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
|
||||
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
|
||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
@@ -232,8 +232,8 @@ $tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_h
|
||||
$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
|
||||
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
|
||||
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
|
||||
@@ -278,7 +278,7 @@ $tabsqlsort[33] = "code ASC";
|
||||
$tabsqlsort[34] = "code ASC";
|
||||
$tabsqlsort[35] = "c.label ASC";
|
||||
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
$tabsqlsort[37] = "sortorder ASC";
|
||||
$tabsqlsort[38] = "rowid, code ASC";
|
||||
$tabsqlsort[39] = "sortorder ASC";
|
||||
$tabsqlsort[40] = "code ASC";
|
||||
@@ -324,7 +324,7 @@ $tabfield[33] = "code,label";
|
||||
$tabfield[34] = "code,label";
|
||||
$tabfield[35] = "label";
|
||||
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfield[37] = "code,label,short_label,unit_type,scale,sortorder";
|
||||
$tabfield[38] = "code,label,url,icon,entity";
|
||||
$tabfield[39] = "code,libelle,sortorder";
|
||||
$tabfield[40] = "code,libelle,picto";
|
||||
@@ -370,7 +370,7 @@ $tabfieldvalue[33] = "code,label";
|
||||
$tabfieldvalue[34] = "code,label";
|
||||
$tabfieldvalue[35] = "label";
|
||||
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale,sortorder";
|
||||
$tabfieldvalue[38] = "code,label,url,icon";
|
||||
$tabfieldvalue[39] = "code,libelle,sortorder";
|
||||
$tabfieldvalue[40] = "code,libelle,picto";
|
||||
@@ -417,7 +417,7 @@ $tabfieldinsert[33] = "code,label";
|
||||
$tabfieldinsert[34] = "code,label";
|
||||
$tabfieldinsert[35] = "label";
|
||||
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale,sortorder";
|
||||
$tabfieldinsert[38] = "code,label,url,icon,entity";
|
||||
$tabfieldinsert[39] = "code,label,sortorder";
|
||||
$tabfieldinsert[40] = "code,libelle,picto";
|
||||
@@ -509,8 +509,8 @@ $tabcond[30] = !empty($conf->label->enabled);
|
||||
$tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled));
|
||||
$tabcond[33] = !empty($conf->hrm->enabled);
|
||||
$tabcond[34] = !empty($conf->hrm->enabled);
|
||||
$tabcond[35] = !empty($conf->expensereport->enabled);
|
||||
$tabcond[36] = !empty($conf->expensereport->enabled);
|
||||
$tabcond[35] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
|
||||
$tabcond[36] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
|
||||
$tabcond[37] = !empty($conf->product->enabled);
|
||||
$tabcond[38] = !empty($conf->socialnetworks->enabled);
|
||||
$tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
|
||||
@@ -1457,6 +1457,10 @@ if ($id) {
|
||||
print $tdsoffields;
|
||||
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd')) {
|
||||
@@ -1476,9 +1480,6 @@ if ($id) {
|
||||
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
|
||||
}
|
||||
|
||||
// Line to enter new values
|
||||
print '<!-- line to add new entry -->';
|
||||
print '<tr class="oddeven nodrag nodrop nohover">';
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -1833,6 +1834,7 @@ if ($id) {
|
||||
$class = '';
|
||||
$showfield = 1;
|
||||
$valuetoshow = empty($obj->{$value}) ? '' : $obj->{$value};
|
||||
$titletoshow = '';
|
||||
|
||||
if ($value == 'entity') {
|
||||
$withentity = $valuetoshow;
|
||||
@@ -1964,6 +1966,11 @@ if ($id) {
|
||||
} elseif (in_array($value, array('recuperableonly'))) {
|
||||
$class = "center";
|
||||
} elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') {
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
$tmpaccountingaccount = new AccountingAccount($db);
|
||||
$tmpaccountingaccount->fetch(0, $valuetoshow, 1);
|
||||
$titletoshow = $langs->transnoentitiesnoconv("Pcgtype").': '.$tmpaccountingaccount->pcg_type;
|
||||
}
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
} elseif ($value == 'fk_tva') {
|
||||
foreach ($form->cache_vatrates as $key => $Tab) {
|
||||
@@ -1973,7 +1980,7 @@ if ($id) {
|
||||
}
|
||||
}
|
||||
} elseif ($value == 'fk_c_exp_tax_cat') {
|
||||
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
|
||||
$valuetoshow = getDictionaryValue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
} elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat') {
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
@@ -2011,7 +2018,7 @@ if ($id) {
|
||||
}
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
print '<!-- '. $value .' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
print '<!-- '. $value .' --><td class="'.$class.'"'.($titletoshow ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2106,7 +2113,7 @@ if ($id) {
|
||||
if ($iserasable) {
|
||||
print '<td class="center">';
|
||||
if ($user->admin) {
|
||||
print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
print '<a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
}
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
print '</td>';
|
||||
|
||||
@@ -268,7 +268,7 @@ class Dolistore
|
||||
// add image or default ?
|
||||
if ($product->id_default_image != '') {
|
||||
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
|
||||
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
|
||||
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" rel="noopener noreferrer" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
|
||||
$images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||
} else {
|
||||
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
||||
@@ -280,11 +280,12 @@ class Dolistore
|
||||
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||
} else {
|
||||
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
||||
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||
$download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||
$download_link = '<a target="_blank" rel="noopener noreferrer" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||
$download_link .= '<br><br><a target="_blank" rel="noopener noreferrer" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||
}
|
||||
|
||||
//checking versions
|
||||
// Set and check version
|
||||
$version = '';
|
||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||
//compatible
|
||||
@@ -307,7 +308,7 @@ class Dolistore
|
||||
}
|
||||
} else {
|
||||
//need update
|
||||
$version = '<span class="compatibleafterupdate">'.$langs->trans(
|
||||
$version = '<span class="compatibleafterupdate">'.$langs->trans(
|
||||
'CompatibleAfterUpdate',
|
||||
DOL_VERSION,
|
||||
$product->dolibarr_min,
|
||||
@@ -316,17 +317,22 @@ class Dolistore
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
|
||||
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
|
||||
|
||||
//output template
|
||||
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">
|
||||
<td class="center" width="210"><div class="newAppParent">'.dol_escape_htmltag($newapp.$images).'</div></td>
|
||||
<td class="margeCote"><h2 class="appTitle">'.dol_escape_htmltag($product->name->language[$this->lang - 1])
|
||||
.'<br><small>'.dol_escape_htmltag($version).'</small></h2>
|
||||
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
||||
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">';
|
||||
$html .= '<td class="center" width="210"><div class="newAppParent">';
|
||||
$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
|
||||
$html .= '</div></td>';
|
||||
$html .= '<td class="margeCote"><h2 class="appTitle">';
|
||||
$html .= dol_escape_htmltag($product->name->language[$this->lang - 1]);
|
||||
$html .= '<br><small>';
|
||||
$html .= $version; // No dol_escape_htmltag, it is already escape html
|
||||
$html .= '</small></h2>';
|
||||
$html .= '<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
||||
// do not load if display none
|
||||
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
|
||||
$html .= '<td class="margeCote center">'.dol_escape_htmltag($price).'</td>';
|
||||
$html .= '<td class="margeCote center">';
|
||||
$html .= $price;
|
||||
$html .= '</td>';
|
||||
$html .= '<td class="margeCote">'.$download_link.'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
@@ -583,6 +583,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$arrayoftypes = array(
|
||||
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
|
||||
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
|
||||
'recordjoinpiece'=>$langs->trans('recordjoinpieceonobject'),
|
||||
'recordevent'=>'RecordEvent');
|
||||
if ($conf->projet->enabled) {
|
||||
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
|
||||
|
||||
@@ -530,7 +530,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,8 @@ $head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'audit', '', -1);
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print getTitleFieldOfList("LogEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
@@ -257,11 +257,12 @@ foreach ($rules as $rule) {
|
||||
if ($rule->fk_c_type_fees == -1) {
|
||||
echo $langs->trans('AllExpenseReport');
|
||||
} else {
|
||||
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
if ($key != $langs->trans($key)) {
|
||||
$key = getDictionaryValue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
if ($key && $key != $langs->trans($key)) {
|
||||
echo $langs->trans($key);
|
||||
} else {
|
||||
echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
|
||||
$value = getDictionaryValue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
|
||||
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,11 +159,12 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
||||
print '<!-- constant = '.$constante.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_object("", $picto[$const]).'</td>';
|
||||
print '<td>'.$langs->trans($desc).'</td>';
|
||||
print '<td class="center" width="100">';
|
||||
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
||||
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
|
||||
if ($value == 0) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
@@ -192,7 +193,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
if ($linkstomode) {
|
||||
$linkstomode .= ' - ';
|
||||
}
|
||||
$linkstomode .= '<a href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
||||
$linkstomode .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
||||
if ($mode == $newmode) {
|
||||
$linkstomode .= '<strong>';
|
||||
}
|
||||
@@ -222,7 +223,7 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
// Add env of ckeditor
|
||||
// This is to show how CKEditor detect browser to understand why editor is disabled or not. To help debug.
|
||||
/*
|
||||
print '<br><script language="javascript">
|
||||
print '<br><script type="text/javascript">
|
||||
function jsdump(obj, id) {
|
||||
var out = \'\';
|
||||
for (var i in obj) {
|
||||
|
||||
@@ -144,12 +144,12 @@ print '<br>';
|
||||
print $langs->trans("NoteOnPathLocation").'<br>';
|
||||
|
||||
$url1 = 'http://www.maxmind.com/en/city?rId=awstats';
|
||||
print $langs->trans("YouCanDownloadFreeDatFileTo", '<a href="'.$url1.'" target="_blank">'.$url1.'</a>');
|
||||
print $langs->trans("YouCanDownloadFreeDatFileTo", '<a href="'.$url1.'" target="_blank" rel="noopener noreferrer external">'.$url1.'</a>');
|
||||
|
||||
print '<br>';
|
||||
|
||||
$url2 = 'http://www.maxmind.com/en/city?rId=awstats';
|
||||
print $langs->trans("YouCanDownloadAdvancedDatFileTo", '<a href="'.$url2.'" target="_blank">'.$url2.'</a>');
|
||||
print $langs->trans("YouCanDownloadAdvancedDatFileTo", '<a href="'.$url2.'" target="_blank" rel="noopener noreferrer external">'.$url2.'</a>');
|
||||
|
||||
if ($geoip) {
|
||||
print '<br><br>';
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file hrm/admin/setup.php
|
||||
* \file htdocs/admin/hrm.php
|
||||
* \ingroup hrm
|
||||
* \brief HrmTest setup page.
|
||||
*/
|
||||
@@ -79,10 +79,12 @@ if ($action == 'update') {
|
||||
if (!empty($max_rank)) {
|
||||
$static_skill = new Skill($db);
|
||||
$TAllSkills = $static_skill->fetchAll();
|
||||
foreach ($TAllSkills as &$skill) {
|
||||
if (empty($skill->lines)) $skill->fetchLines();
|
||||
if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
|
||||
$skill->createSkills(count($skill->lines) + 1);
|
||||
if (is_array($TAllSkills)) {
|
||||
foreach ($TAllSkills as &$skill) {
|
||||
if (empty($skill->lines)) $skill->fetchLines();
|
||||
if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
|
||||
$skill->createSkills(count($skill->lines) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -467,13 +469,17 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print load_fiche_titre($langs->trans('OtherOptions'), '', '');
|
||||
|
||||
if (empty($conf->global->HRM_MAXRANK)) {
|
||||
$conf->global->HRM_MAXRANK = Skill::DEFAULT_MAX_RANK_PER_SKILL;
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
@@ -569,7 +575,7 @@ if ($action == 'edit') {
|
||||
} else {
|
||||
if (!empty($arrayofparameters)) {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
|
||||
@@ -299,6 +299,8 @@ $head = ihm_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, $mode, '', -1, '');
|
||||
|
||||
print '<br>';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
if ($mode == 'template') {
|
||||
@@ -451,11 +453,11 @@ if ($mode == 'other') {
|
||||
print '</table>' . "\n";
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Other
|
||||
@@ -577,9 +579,9 @@ if ($mode == 'login') {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
|
||||
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmax45">';
|
||||
print $langs->trans("Parameter");
|
||||
print '</td><td class="titlefieldmiddle">';
|
||||
print '</td><td>';
|
||||
print $langs->trans("Value");
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -630,7 +632,6 @@ if ($mode == 'login') {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '</div>';
|
||||
|
||||
@@ -83,7 +83,8 @@ if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INF
|
||||
$setupcompanynotcomplete = 1;
|
||||
}
|
||||
print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
|
||||
print '<br><br>'.$langs->trans("SetupDescription3b");
|
||||
print '<br><br>';
|
||||
print $langs->trans("SetupDescription3b");
|
||||
if (!empty($setupcompanynotcomplete)) {
|
||||
$langs->load("errors");
|
||||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
|
||||
@@ -92,6 +93,7 @@ if (!empty($setupcompanynotcomplete)) {
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Show info setup module
|
||||
print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@@ -29,10 +29,11 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formldap.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("admin");
|
||||
$langs->loadLangs(array("admin", "ldap"));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@@ -99,6 +100,9 @@ if (empty($reshook)) {
|
||||
if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_ACTIVE', GETPOST("activememberstypes", 'aZ09'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
if (!dolibarr_set_const($db, 'LDAP_PASSWORD_HASH_TYPE', GETPOST("LDAP_PASSWORD_HASH_TYPE", 'aZ09'), 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
@@ -129,7 +133,7 @@ if (!function_exists("ldap_connect")) {
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$formldap = new FormLdap($db);
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@@ -146,13 +150,9 @@ print "</tr>\n";
|
||||
// Synchro utilisateurs/groupes active
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnSynchroActive").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['0'] = $langs->trans("No");
|
||||
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr");
|
||||
$arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP");
|
||||
print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE);
|
||||
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_SYNCHRO_ACTIVE'), 'activesynchro');
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnSynchroActiveExample").'</span>';
|
||||
if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) {
|
||||
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && empty($conf->global->LDAP_USER_DN)) {
|
||||
print '<br><span class="error">'.$langs->trans("LDAPSetupNotComplete").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
@@ -160,32 +160,21 @@ print '</td></tr>';
|
||||
// Synchro contact active
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnContactActive").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['0'] = $langs->trans("No");
|
||||
$arraylist['1'] = $langs->trans("DolibarrToLDAP");
|
||||
print $form->selectarray('activecontact', $arraylist, $conf->global->LDAP_CONTACT_ACTIVE);
|
||||
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_CONTACT_ACTIVE'), 'activecontact', array(Ldap::SYNCHRO_LDAP_TO_DOLIBARR));
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnContactActiveExample").'</span></td></tr>';
|
||||
}
|
||||
|
||||
// Synchro member active
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberActive").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['0'] = $langs->trans("No");
|
||||
$arraylist['1'] = $langs->trans("DolibarrToLDAP");
|
||||
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
|
||||
print $form->selectarray('activemembers', $arraylist, $conf->global->LDAP_MEMBER_ACTIVE);
|
||||
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_ACTIVE'), 'activemembers', array(), 2);
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberActiveExample").'</span></td></tr>';
|
||||
}
|
||||
|
||||
// Synchro member type active
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberTypeActive").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['0'] = $langs->trans("No");
|
||||
$arraylist['1'] = $langs->trans("DolibarrToLDAP");
|
||||
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
|
||||
print $form->selectarray('activememberstypes', $arraylist, $conf->global->LDAP_MEMBER_TYPE_ACTIVE);
|
||||
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE'), 'activememberstypes', array(), 2);
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberTypeActiveExample").'</span></td></tr>';
|
||||
}
|
||||
|
||||
@@ -202,55 +191,46 @@ print "</tr>\n";
|
||||
|
||||
// Type
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Type").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['activedirectory'] = 'Active Directory';
|
||||
$arraylist['openldap'] = 'OpenLdap';
|
||||
$arraylist['egroupware'] = 'Egroupware';
|
||||
print $form->selectarray('type', $arraylist, $conf->global->LDAP_SERVER_TYPE);
|
||||
print $formldap->selectLdapServerType(getDolGlobalString('LDAP_SERVER_TYPE'), 'type');
|
||||
print '</td><td> </td></tr>';
|
||||
|
||||
// Version
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Version").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['3'] = 'Version 3';
|
||||
$arraylist['2'] = 'Version 2';
|
||||
print $form->selectarray('LDAP_SERVER_PROTOCOLVERSION', $arraylist, $conf->global->LDAP_SERVER_PROTOCOLVERSION);
|
||||
print $formldap->selectLdapServerProtocolVersion(getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION'), 'LDAP_SERVER_PROTOCOLVERSION');
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerProtocolVersion").'</span></td></tr>';
|
||||
|
||||
// Serveur primaire
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("LDAPPrimaryServer").'</td><td>';
|
||||
print '<input class="minwidth200" type="text" name="host" value="'.$conf->global->LDAP_SERVER_HOST.'">';
|
||||
print '<input class="minwidth200" type="text" name="host" value="'.getDolGlobalString('LDAP_SERVER_HOST').'">';
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerExample").'</span></td></tr>';
|
||||
|
||||
// Serveur secondaire
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("LDAPSecondaryServer").'</td><td>';
|
||||
print '<input class="minwidth200" type="text" name="slave" value="'.$conf->global->LDAP_SERVER_HOST_SLAVE.'">';
|
||||
print '<input class="minwidth200" type="text" name="slave" value="'.getDolGlobalString('LDAP_SERVER_HOST_SLAVE').'">';
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerExample").'</span></td></tr>';
|
||||
|
||||
// Port
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerPort").'</td><td>';
|
||||
if (!empty($conf->global->LDAP_SERVER_PORT)) {
|
||||
print '<input class="width75" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
|
||||
} else {
|
||||
print '<input class="width75" type="text" name="port" value="389">';
|
||||
}
|
||||
print '<input class="width75" type="text" name="port" value="'.getDolGlobalString('LDAP_SERVER_PORT', '389').'">';
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerPortExample").'</span></td></tr>';
|
||||
|
||||
// DNserver
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerDn").'</td><td>';
|
||||
print '<input class="minwidth300" type="text" name="dn" value="'.$conf->global->LDAP_SERVER_DN.'">';
|
||||
print '<input class="minwidth300" type="text" name="dn" value="'.getDolGlobalString('LDAP_SERVER_DN').'">';
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerDnExample").'</span></td></tr>';
|
||||
|
||||
// Utiliser TLS
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerUseTLS").'</td><td>';
|
||||
$arraylist = array();
|
||||
$arraylist['0'] = $langs->trans("No");
|
||||
$arraylist['1'] = $langs->trans("Yes");
|
||||
print $form->selectarray('usetls', $arraylist, $conf->global->LDAP_SERVER_USE_TLS);
|
||||
print $form->selectyesno('usetls', getDolGlobalInt('LDAP_SERVER_USE_TLS'), 1);
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerUseTLSExample").'</span></td></tr>';
|
||||
|
||||
// Password hash type
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPPasswordHashType").'</td><td>';
|
||||
print $formldap->selectLdapPasswordHashType(getDolGlobalString('LDAP_PASSWORD_HASH_TYPE'), 'LDAP_PASSWORD_HASH_TYPE');
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPPasswordHashTypeExample").'</span></td></tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("ForANonAnonymousAccess").'</td>';
|
||||
print "</tr>\n";
|
||||
@@ -258,17 +238,13 @@ print "</tr>\n";
|
||||
// DNAdmin
|
||||
print '<!-- LDAP_ADMIN_DN -->';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPAdminDn").'</td><td>';
|
||||
print '<input class="minwidth300" type="text" name="admin" value="'.$conf->global->LDAP_ADMIN_DN.'">';
|
||||
print '<input class="minwidth300" type="text" name="admin" value="'.getDolGlobalString('LDAP_ADMIN_DN').'">';
|
||||
print '</td><td class="maxwidthhalf"><span class="opacitymedium">'.$langs->trans("LDAPAdminDnExample").'</span></td></tr>';
|
||||
|
||||
// Pass
|
||||
print '<!-- LDAP_ADMIN_PASS -->';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>';
|
||||
if (!empty($conf->global->LDAP_ADMIN_PASS)) {
|
||||
print '<input class="minwidth150" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; // je le met en visible pour test
|
||||
} else {
|
||||
print '<input class="minwidth150" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
|
||||
}
|
||||
print '<input class="minwidth150" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
|
||||
print '</td><td><span class="opacitymedium">'.$langs->trans('Password').' (ex: secret)</span></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -290,24 +266,24 @@ if (function_exists("ldap_connect")) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>';
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'test') {
|
||||
if ($action == 'test') {
|
||||
$ldap = new Ldap(); // Les parametres sont passes et recuperes via $conf
|
||||
|
||||
$result = $ldap->connect_bind();
|
||||
if ($result > 0) {
|
||||
// Test ldap connect and bind
|
||||
print img_picto('', 'info').' ';
|
||||
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT')).'</span>';
|
||||
print '<br>';
|
||||
|
||||
if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) {
|
||||
if (!empty($conf->global->LDAP_ADMIN_DN) && !empty($conf->global->LDAP_ADMIN_PASS)) {
|
||||
if ($result == 2) {
|
||||
print img_picto('', 'info').' ';
|
||||
print '<span class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<span class="ok">'.$langs->trans("LDAPBindOK", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT'), $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<br>';
|
||||
} else {
|
||||
print img_picto('', 'error').' ';
|
||||
print '<span class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<span class="error">'.$langs->trans("LDAPBindKO", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT'), $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
|
||||
print '<br>';
|
||||
print $langs->trans("Error").' '.$ldap->error;
|
||||
print '<br>';
|
||||
@@ -330,10 +306,10 @@ if (function_exists("ldap_connect")) {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$unbind = $ldap->unbind();
|
||||
$ldap->unbind();
|
||||
} else {
|
||||
print img_picto('', 'error').' ';
|
||||
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
|
||||
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT')).'</span>';
|
||||
print '<br>';
|
||||
print $langs->trans("Error").' '.$ldap->error;
|
||||
print '<br>';
|
||||
|
||||
@@ -218,7 +218,7 @@ print '</form>';
|
||||
/*
|
||||
* Test de la connexion
|
||||
*/
|
||||
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
|
||||
if (getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
||||
$butlabel = $langs->trans("LDAPTestSynchroGroup");
|
||||
$testlabel = 'testgroup';
|
||||
$key = $conf->global->LDAP_KEY_GROUPS;
|
||||
@@ -226,7 +226,7 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
|
||||
$objectclass = $conf->global->LDAP_GROUP_OBJECT_CLASS;
|
||||
|
||||
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
|
||||
} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
|
||||
} elseif (getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
|
||||
$butlabel = $langs->trans("LDAPTestSearch");
|
||||
$testlabel = 'testsearchgroup';
|
||||
$key = $conf->global->LDAP_KEY_GROUPS;
|
||||
|
||||
@@ -188,7 +188,7 @@ print '</form>';
|
||||
/*
|
||||
* Test de la connexion
|
||||
*/
|
||||
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
|
||||
if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
||||
$butlabel = $langs->trans("LDAPTestSynchroMemberType");
|
||||
$testlabel = 'testmembertype';
|
||||
$key = $conf->global->LDAP_KEY_MEMBERS_TYPES;
|
||||
|
||||
@@ -192,7 +192,7 @@ print "</tr>\n";
|
||||
// DN Pour les utilisateurs
|
||||
print '<!-- LDAP_USER_DN -->';
|
||||
print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserDn").'</span></td><td>';
|
||||
print '<input size="48" type="text" name="user" value="'.$conf->global->LDAP_USER_DN.'">';
|
||||
print '<input size="48" type="text" name="user" value="'.getDolGlobalString('LDAP_USER_DN').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPUserDnExample").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
@@ -200,7 +200,7 @@ print '</tr>';
|
||||
// List of object class used to define attributes in structure
|
||||
print '<!-- LDAP_USER_OBJECT_CLASS -->';
|
||||
print '<tr class="oddeven"><td><span class="fieldrequired">'.$langs->trans("LDAPUserObjectClassList").'</span></td><td>';
|
||||
print '<input size="48" type="text" name="objectclass" value="'.$conf->global->LDAP_USER_OBJECT_CLASS.'">';
|
||||
print '<input size="48" type="text" name="objectclass" value="'.getDolGlobalString('LDAP_USER_OBJECT_CLASS').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPUserObjectClassListExample").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
@@ -208,7 +208,7 @@ print '</tr>';
|
||||
// Filter, used to filter search
|
||||
print '<!-- LDAP_FILTER_CONNECTION -->';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
|
||||
print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
|
||||
print '<input size="48" type="text" name="filterconnection" value="'.getDolGlobalString('LDAP_FILTER_CONNECTION').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
@@ -225,168 +225,168 @@ print "</tr>\n";
|
||||
|
||||
// Common name
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFullname").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_FIELD_FULLNAME.'">';
|
||||
print '<input size="25" type="text" name="fieldfullname" value="'.getDolGlobalString('LDAP_FIELD_FULLNAME').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFullnameExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FULLNAME) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FULLNAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FULLNAME') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_FIELD_NAME.'">';
|
||||
print '<input size="25" type="text" name="fieldname" value="'.getDolGlobalString('LDAP_FIELD_NAME').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_NAME) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_NAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_NAME') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFirstName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfirstname" value="'.$conf->global->LDAP_FIELD_FIRSTNAME.'">';
|
||||
print '<input size="25" type="text" name="fieldfirstname" value="'.getDolGlobalString('LDAP_FIELD_FIRSTNAME').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFirstNameExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FIRSTNAME) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FIRSTNAME"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FIRSTNAME') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Login unix
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginUnix").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldlogin" value="'.$conf->global->LDAP_FIELD_LOGIN.'">';
|
||||
print '<input size="25" type="text" name="fieldlogin" value="'.getDolGlobalString('LDAP_FIELD_LOGIN').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldLoginExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Login samba
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldLoginSamba").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldloginsamba" value="'.$conf->global->LDAP_FIELD_LOGIN_SAMBA.'">';
|
||||
print '<input size="25" type="text" name="fieldloginsamba" value="'.getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldLoginSambaExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN_SAMBA) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_LOGIN_SAMBA"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Password not crypted
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpassword" value="'.$conf->global->LDAP_FIELD_PASSWORD.'">';
|
||||
print '<input size="25" type="text" name="fieldpassword" value="'.getDolGlobalString('LDAP_FIELD_PASSWORD').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Password crypted
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.$conf->global->LDAP_FIELD_PASSWORD_CRYPTED.'">';
|
||||
print '<input size="25" type="text" name="fieldpasswordcrypted" value="'.getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPasswordExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Mail
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMail").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldmail" value="'.$conf->global->LDAP_FIELD_MAIL.'">';
|
||||
print '<input size="25" type="text" name="fieldmail" value="'.getDolGlobalString('LDAP_FIELD_MAIL').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldMailExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MAIL) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MAIL"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MAIL') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldPhone").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldphone" value="'.$conf->global->LDAP_FIELD_PHONE.'">';
|
||||
print '<input size="25" type="text" name="fieldphone" value="'.getDolGlobalString('LDAP_FIELD_PHONE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldPhoneExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_PHONE) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_PHONE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_PHONE') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Mobile
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldMobile").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldmobile" value="'.$conf->global->LDAP_FIELD_MOBILE.'">';
|
||||
print '<input size="25" type="text" name="fieldmobile" value="'.getDolGlobalString('LDAP_FIELD_MOBILE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldMobileExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MOBILE) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_MOBILE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_MOBILE') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Skype
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSkype").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldskype" value="'.$conf->global->LDAP_FIELD_SKYPE.'">';
|
||||
print '<input size="25" type="text" name="fieldskype" value="'.getDolGlobalString('LDAP_FIELD_SKYPE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldSkypeExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SKYPE) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SKYPE"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SKYPE') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Fax
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldFax").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfax" value="'.$conf->global->LDAP_FIELD_FAX.'">';
|
||||
print '<input size="25" type="text" name="fieldfax" value="'.getDolGlobalString('LDAP_FIELD_FAX').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldFaxExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FAX) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_FAX"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_FAX') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Company
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCompany").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcompany" value="'.$conf->global->LDAP_FIELD_COMPANY.'">';
|
||||
print '<input size="25" type="text" name="fieldcompany" value="'.getDolGlobalString('LDAP_FIELD_COMPANY').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldCompanyExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Address
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldAddress").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldaddress" value="'.$conf->global->LDAP_FIELD_ADDRESS.'">';
|
||||
print '<input size="25" type="text" name="fieldaddress" value="'.getDolGlobalString('LDAP_FIELD_ADDRESS').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldAddressExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// ZIP
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldZip").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldzip" value="'.$conf->global->LDAP_FIELD_ZIP.'">';
|
||||
print '<input size="25" type="text" name="fieldzip" value="'.getDolGlobalString('LDAP_FIELD_ZIP').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldZipExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// TOWN
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTown").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtown" value="'.$conf->global->LDAP_FIELD_TOWN.'">';
|
||||
print '<input size="25" type="text" name="fieldtown" value="'.getDolGlobalString('LDAP_FIELD_TOWN').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTownExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// COUNTRY
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldCountry").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldcountry" value="'.$conf->global->LDAP_FIELD_COUNTRY.'">';
|
||||
print '<input size="25" type="text" name="fieldcountry" value="'.getDolGlobalString('LDAP_FIELD_COUNTRY').'">';
|
||||
print '</td><td> </td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldTitle").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldtitle" value="'.$conf->global->LDAP_FIELD_TITLE.'">';
|
||||
print '<input size="25" type="text" name="fieldtitle" value="'.getDolGlobalString('LDAP_FIELD_TITLE').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldTitleExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Note
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Note").'</td><td>';
|
||||
print '<input size="25" type="text" name="fielddescription" value="'.$conf->global->LDAP_FIELD_DESCRIPTION.'">';
|
||||
print '<input size="25" type="text" name="fielddescription" value="'.getDolGlobalString('LDAP_FIELD_DESCRIPTION').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Sid
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldSid").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldsid" value="'.$conf->global->LDAP_FIELD_SID.'">';
|
||||
print '<input size="25" type="text" name="fieldsid" value="'.getDolGlobalString('LDAP_FIELD_SID').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>';
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) ? ' checked' : '')."></td>";
|
||||
print '<td class="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SID') ? ' checked' : '')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Group id
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldGroupid").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldgroupid" value="'.$conf->global->LDAP_FIELD_GROUPID.'">';
|
||||
print '<input size="25" type="text" name="fieldgroupid" value="'.getDolGlobalString('LDAP_FIELD_GROUPID').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldGroupidExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Userid
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldUserid").'</td><td>';
|
||||
print '<input size="25" type="text" name="fielduserid" value="'.$conf->global->LDAP_FIELD_USERID.'">';
|
||||
print '<input size="25" type="text" name="fielduserid" value="'.getDolGlobalString('LDAP_FIELD_USERID').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldUseridExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Home Directory
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectory").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldhomedirectory" value="'.$conf->global->LDAP_FIELD_HOMEDIRECTORY.'">';
|
||||
print '<input size="25" type="text" name="fieldhomedirectory" value="'.getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY').'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldHomedirectoryExample").'</td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Home Directory Prefix
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFieldHomedirectoryprefix").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldhomedirectoryprefix" value="'.$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX.'">';
|
||||
print '<input size="25" type="text" name="fieldhomedirectoryprefix" value="'.getDolGlobalString('LDAP_FIELD_HOMEDIRECTORYPREFIX').'">';
|
||||
print '</td><td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
@@ -405,20 +405,20 @@ print '</form>';
|
||||
/*
|
||||
* Test de la connexion
|
||||
*/
|
||||
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
|
||||
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
|
||||
$butlabel = $langs->trans("LDAPTestSynchroUser");
|
||||
$testlabel = 'testuser';
|
||||
$key = $conf->global->LDAP_KEY_USERS;
|
||||
$dn = $conf->global->LDAP_USER_DN;
|
||||
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
|
||||
$key = getDolGlobalString('LDAP_KEY_USERS');
|
||||
$dn = getDolGlobalString('LDAP_USER_DN');
|
||||
$objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
|
||||
|
||||
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
|
||||
} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
|
||||
} elseif (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
|
||||
$butlabel = $langs->trans("LDAPTestSearch");
|
||||
$testlabel = 'testsearchuser';
|
||||
$key = $conf->global->LDAP_KEY_USERS;
|
||||
$dn = $conf->global->LDAP_USER_DN;
|
||||
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
|
||||
$key = getDolGlobalString('LDAP_KEY_USERS');
|
||||
$dn = getDolGlobalString('LDAP_USER_DN');
|
||||
$objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
|
||||
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
|
||||
}
|
||||
|
||||
@@ -479,29 +479,29 @@ if (function_exists("ldap_connect")) {
|
||||
|
||||
if ($result > 0) {
|
||||
$required_fields = array(
|
||||
$conf->global->LDAP_KEY_USERS,
|
||||
$conf->global->LDAP_FIELD_FULLNAME,
|
||||
$conf->global->LDAP_FIELD_NAME,
|
||||
$conf->global->LDAP_FIELD_FIRSTNAME,
|
||||
$conf->global->LDAP_FIELD_LOGIN,
|
||||
$conf->global->LDAP_FIELD_LOGIN_SAMBA,
|
||||
$conf->global->LDAP_FIELD_PASSWORD,
|
||||
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
||||
$conf->global->LDAP_FIELD_PHONE,
|
||||
$conf->global->LDAP_FIELD_FAX,
|
||||
$conf->global->LDAP_FIELD_SKYPE,
|
||||
$conf->global->LDAP_FIELD_MOBILE,
|
||||
$conf->global->LDAP_FIELD_MAIL,
|
||||
$conf->global->LDAP_FIELD_TITLE,
|
||||
$conf->global->LDAP_FIELD_DESCRIPTION,
|
||||
$conf->global->LDAP_FIELD_SID
|
||||
getDolGlobalString('LDAP_KEY_USERS'),
|
||||
getDolGlobalString('LDAP_FIELD_FULLNAME'),
|
||||
getDolGlobalString('LDAP_FIELD_NAME'),
|
||||
getDolGlobalString('LDAP_FIELD_FIRSTNAME'),
|
||||
getDolGlobalString('LDAP_FIELD_LOGIN'),
|
||||
getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'),
|
||||
getDolGlobalString('LDAP_FIELD_PASSWORD'),
|
||||
getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED'),
|
||||
getDolGlobalString('LDAP_FIELD_PHONE'),
|
||||
getDolGlobalString('LDAP_FIELD_FAX'),
|
||||
getDolGlobalString('LDAP_FIELD_SKYPE'),
|
||||
getDolGlobalString('LDAP_FIELD_MOBILE'),
|
||||
getDolGlobalString('LDAP_FIELD_MAIL'),
|
||||
getDolGlobalString('LDAP_FIELD_TITLE'),
|
||||
getDolGlobalString('LDAP_FIELD_DESCRIPTION'),
|
||||
getDolGlobalString('LDAP_FIELD_SID')
|
||||
);
|
||||
|
||||
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
||||
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
|
||||
|
||||
// Get from LDAP database an array of results
|
||||
$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
|
||||
$ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1);
|
||||
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
|
||||
|
||||
if (is_array($ldapusers)) {
|
||||
@@ -523,8 +523,8 @@ if (function_exists("ldap_connect")) {
|
||||
print "<br>\n";
|
||||
print "LDAP search for user:<br>\n";
|
||||
print "search: *<br>\n";
|
||||
print "userDN: ".$conf->global->LDAP_USER_DN."<br>\n";
|
||||
print "useridentifier: ".$conf->global->LDAP_KEY_USERS."<br>\n";
|
||||
print "userDN: ".getDolGlobalString('LDAP_USER_DN')."<br>\n";
|
||||
print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')."<br>\n";
|
||||
print "required_fields: ".implode(',', $required_fields)."<br>\n";
|
||||
print "=> ".count($liste)." records<br>\n";
|
||||
print "\n<br>";
|
||||
|
||||
@@ -237,7 +237,7 @@ if (empty($mysoc->country_code)) {
|
||||
|
||||
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
|
||||
$sql .= " ORDER BY t.taux ASC";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@@ -105,7 +105,7 @@ foreach ($list as $key) {
|
||||
// Value
|
||||
print '<td>';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
|
||||
} else {
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
|
||||
|
||||
if ($action == 'edit') {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initfields()
|
||||
{
|
||||
@@ -292,7 +292,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
clearstatcache();
|
||||
@@ -543,7 +543,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
@@ -829,27 +829,41 @@ if ($action == 'edit') {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD)) {
|
||||
// List of string to add in SPF if the setup use the mail method. Example 'include:sendgrid.net include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_MAIL_SPF_STRING_TO_ADD);
|
||||
} else {
|
||||
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
||||
// List of IP show as record to add in SPF if we use the mail method
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS)) {
|
||||
// List of IP show as record to add as allowed IP if we use the smtp method. Value is '1.2.3.4, [aaaa:bbbb:cccc:dddd]'
|
||||
// TODO Add a key to allow to show the IP/name of server detected dynamically
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS -->'.$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD)) { // Should be required only if you have preset the Dolibarr to use your own SMTP and you want to warn users to update their domain name to match your SMTP server.
|
||||
// List of string to add in SPF if we use the smtp method. Example 'include:spf.mydomain.com'
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
$text .= ($text ? '<br><br>' : '').'<!-- MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD -->'.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
}
|
||||
}
|
||||
$companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
|
||||
$dnsinfo = false;
|
||||
if (!empty($companyemail) && function_exists('dns_get_record')) {
|
||||
$arrayofemailparts = explode('@', $companyemail);
|
||||
if (count($arrayofemailparts) == 2) {
|
||||
$domain = $arrayofemailparts[1];
|
||||
$dnsinfo = dns_get_record($domain, DNS_TXT);
|
||||
}
|
||||
}
|
||||
if (!empty($dnsinfo) && is_array($dnsinfo)) {
|
||||
foreach ($dnsinfo as $info) {
|
||||
if (strpos($info['txt'], 'v=spf') !== false) {
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($text) {
|
||||
print info_admin($text);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
|
||||
|
||||
if ($action == 'edit') {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initfields()
|
||||
{
|
||||
@@ -243,7 +243,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_emailing', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
clearstatcache();
|
||||
@@ -412,7 +412,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_emailing', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@@ -597,7 +597,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
|
||||
@@ -225,6 +225,9 @@ if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
|
||||
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
|
||||
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) {
|
||||
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport'));
|
||||
}
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||
}
|
||||
@@ -654,7 +657,7 @@ if ($action == 'view') {
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$align.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
if (in_array($value, array('topic'))) {
|
||||
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
|
||||
@@ -894,7 +897,7 @@ if ($resql) {
|
||||
$valuetoshow = $langs->trans("Content"); $showfield = 0;
|
||||
}
|
||||
if ($fieldlist[$field] == 'content_lines') {
|
||||
$valuetoshow = $langs->trans("ContentLines"); $showfield = 0;
|
||||
$valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
|
||||
}
|
||||
|
||||
// Show fields
|
||||
@@ -973,6 +976,14 @@ if ($resql) {
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
if ($tmpfieldlist == 'content_lines') {
|
||||
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
@@ -1114,35 +1125,6 @@ if ($resql) {
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
/*
|
||||
$fieldsforcontent = array('content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||
{
|
||||
$fieldsforcontent = array('content', 'content_lines');
|
||||
}
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
{
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$valuetoshow = $obj->{$tmpfieldlist};
|
||||
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
|
||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$i.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$i, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%', 1);
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
print '<td></td><td></td><td></td>';
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
|
||||
|
||||
if ($action == 'edit') {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initfields()
|
||||
{
|
||||
@@ -232,7 +232,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_ticket', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
|
||||
clearstatcache();
|
||||
@@ -387,7 +387,7 @@ if ($action == 'edit') {
|
||||
print dol_get_fiche_head($head, 'common_ticket', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@@ -255,7 +255,7 @@ llxHeader('', $langs->trans("Menu"));
|
||||
|
||||
|
||||
if ($action == 'create') {
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_topleft()
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user