mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' into Add-option-in-stock-for-affect-warehouse-
This commit is contained in:
commit
9efcc631d7
|
|
@ -291,7 +291,7 @@ script:
|
|||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
|
||||
#phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
|
||||
set +e
|
||||
echo
|
||||
|
|
@ -404,6 +404,10 @@ script:
|
|||
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log
|
||||
php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log
|
||||
php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log
|
||||
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log
|
||||
php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log
|
||||
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
|
||||
|
||||
# Enable modules not enabled into original dump
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
echo $?
|
||||
|
|
|
|||
309
ChangeLog
309
ChangeLog
|
|
@ -3,32 +3,311 @@ English Dolibarr ChangeLog
|
|||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
|
||||
For Users:
|
||||
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||
NEW: Add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists.
|
||||
***** ChangeLog for 12.0 compared to 11.0 *****
|
||||
For users:
|
||||
|
||||
For Developers or integrators:
|
||||
* A new way to navigate between pages in list is available. To use it, you must
|
||||
- replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
|
||||
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste
|
||||
* UserGroup class has been refactored with new architecture. Triggers of class UserGroup are now USERGROUP_CREATE, USERGROUP_MODIFY, USERGROUP_DELETE
|
||||
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||
NEW: Receipt printer module moved from 'development' to 'experimental'
|
||||
NEW: Add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists.
|
||||
NEW: add numbering module for TakePOS module
|
||||
NEW: 2 new options when creating an invoice from time spent on a project : by period or by task
|
||||
NEW: Accountancy add column thirdparty on binding page
|
||||
NEW: Accountancy - Add Export for Fiducial Winfic eWinfic WinSis Compta
|
||||
NEW: Accountancy - Add Export LD compta version 10
|
||||
NEW: Accountancy - Add mode intra & export for product or service bought
|
||||
NEW: Accountancy - Add possibility to manage a short alternative label for account - Use to simplify accountancy
|
||||
NEW: Accountancy - General ledger - Add an option to search not reconciled lines
|
||||
NEW: Add accountancy code of thirdparty in contact and supplier export
|
||||
NEW: add a link to notes in members list
|
||||
NEW: add a parameter to group same products in TakePOS
|
||||
NEW: add a parameter to sort product by label in TakePOS
|
||||
NEW: Add a profil to import contact categories
|
||||
NEW: Add company extrafields into order export
|
||||
NEW: add const CASHDESK_FORCE_DECREASE_STOCK to force batch decrementation
|
||||
NEW: add const TAKEPOS_NUMPAD_USE_PAYMENT_ICON to use icons on payment buttons
|
||||
NEW: add csv separator setup in module admin
|
||||
NEW: add dedicated substitutions keys for extrafields of type date and datetime
|
||||
NEW: add default warehouse for dispatch
|
||||
NEW: Add due date in feature "Export accounting documents"
|
||||
NEW: Add duration information for fichinter
|
||||
NEW: Start support of Dark theme into ELDY theme
|
||||
NEW: Add field author public alias for blog post on website module
|
||||
NEW: Add "finished" field on product list
|
||||
NEW: Add French association chart of accounts 2018
|
||||
NEW: Add French farm chart of accounts 2014
|
||||
NEW: Add French foundation chart of accounts 2018
|
||||
NEW: add global reduction in cash desk
|
||||
NEW: Add graph type 'piesemicircle'
|
||||
NEW: Add hook getInputIdProf. Better solution for #13228
|
||||
NEW: Add hook on margin list page
|
||||
NEW: add icon on payment buttons in cash desk
|
||||
NEW: Add include various payments and loans in accounting report with simplfified accountancy
|
||||
NEW: Add invoice stat graph and categ search
|
||||
NEW: Addition of delivery times in substitution variables
|
||||
NEW: add member to validate on dashboard
|
||||
NEW: Add method to add social network sharing buttons on blog posts
|
||||
NEW: add multicurrency columns to document lists
|
||||
NEW: add numbering module for cash desk
|
||||
NEW: add Opening Balance column to balance.php
|
||||
NEW: add opportunity status in project stats
|
||||
NEW: Add option PDF_USE_ALSO_LANGUAGE_CODE to generate PDF in 2 languages
|
||||
NEW: Add option to hide all inactive users into combo list of users.
|
||||
NEW: add PDF certificate if present on document folder
|
||||
NEW: add product if only one found
|
||||
NEW: Add product on key "Enter" in search bar
|
||||
NEW: add professional ID 1 in sepamandate document
|
||||
NEW: Add Project Ref Column on list of social/fiscal contributions
|
||||
NEW: add Project Ref in events export
|
||||
NEW: add public and private notes in propal list
|
||||
NEW: Add social networks of the company
|
||||
NEW: Add sorting for contacts of ... pages
|
||||
NEW: Add subtitution variables for url of document in backoffice
|
||||
NEW: Add tel and fax in warehouse card
|
||||
NEW: add total of value in product stat
|
||||
NEW: add total weighted amount in project list
|
||||
NEW: add units in product list
|
||||
NEW: add VAT ID in sepamandate document
|
||||
NEW: add VAT rates in free zone for product/service in TakePOS
|
||||
NEW: add weighted amount on project/opportunity
|
||||
NEW: add width and height measures in product list
|
||||
NEW: add WYSiWYG on member type's description
|
||||
NEW: [Allow constants values to be overridden by environment variables]
|
||||
NEW: Allow custom module class origine type in Mouvementstock
|
||||
NEW: allow display extrafields on pdf
|
||||
NEW: Allow extrafields on pdf : extend to line desc
|
||||
NEW: allow time consumed to be linked to another task
|
||||
NEW: Another way to navigate between pages for some lists
|
||||
NEW: Add author column in the client/supplier invoice lists and into order list
|
||||
NEW: bank account tags for invoice ODT template
|
||||
NEW: Bar Restaurant tab and Auto order
|
||||
NEW: better filter on shipment list as other list
|
||||
NEW: Better php module view admin
|
||||
NEW: Bookkeeping - Add link to document & pdf
|
||||
NEW: Bookmarks are now in top menu bar
|
||||
NEW: Can check all events in one click in setup of audited events
|
||||
NEW: Can create an deposit from order using a percentage of qty.
|
||||
NEW: Can edit option PDF_USE_ALSO_LANGUAGE_CODE from PDF setup page
|
||||
NEW: Can enter and edit stripe credit card using the Stripe card ID
|
||||
NEW: Can filter on donation status in list
|
||||
NEW: Can replace a string into all pages in website module
|
||||
NEW: Can select several fields to personalize list before submit.
|
||||
NEW: Can select which element to export in export accounting documents.
|
||||
NEW: can update contact in import model
|
||||
NEW: Cash Fence in TakePOS
|
||||
NEW: Categories and subcategories sorted by label in TakePOS
|
||||
NEW: Categories for actioncomm
|
||||
NEW: Category filter for bank and warehouse list
|
||||
NEW: Chart of accounts to Ecuador
|
||||
NEW: class tool for converting units
|
||||
NEW: Close #13011 Add button create thirdparty when creating intervention
|
||||
NEW: Colorful theme for TakePOS
|
||||
NEW: columns units in product list
|
||||
NEW: compatibility of translabel with more dict
|
||||
NEW: Confirm file delete on fracture card
|
||||
NEW: "contact_civility" for ODT templates
|
||||
NEW: CUPS printing compatibility for TakePOS
|
||||
NEW: Customer command list - Add date start & date end
|
||||
NEW: display weight in shipment list
|
||||
NEW: Documentation about PHP support in Dolibarr
|
||||
NEW: Donation - Update FR CERFA to 11580*04
|
||||
NEW: Easier way to setup the different types of tax. Better visibility.
|
||||
NEW: enable put for agendaevents api
|
||||
NEW: Expedition list - Add date start & date end
|
||||
NEW: Experiment supplier packaging with option PRODUCT_USE_SUPPLIER_PACKAGING: Using price according to the minimum quantity
|
||||
NEW: Export module, add extrafields for Contract and Contract line
|
||||
NEW: Extend retained warranty to be available for all invoices
|
||||
NEW: filter by product on supplier order API
|
||||
NEW: French new regions
|
||||
NEW: get documents for categories with RESP API
|
||||
NEW: get proposal by ref with API
|
||||
NEW: Hidden option MAIN_TEMP_DIR
|
||||
NEW: hook and data id
|
||||
NEW: hook on ics generation to add more events in eventarray
|
||||
NEW: hook on product load stats
|
||||
NEW: If $dolibarr_main_force_https is set, the flag 'secure' on session
|
||||
NEW: ignore dir for apple pay with stripe
|
||||
NEW: Invoice list - Add date start & date end
|
||||
NEW: invoice list: enable multicurrency columns
|
||||
NEW: labels on reduction buttons in cash desk
|
||||
NEW: Minimum sell prices taking into account in TakePOS
|
||||
NEW: monthly view to enter time
|
||||
NEW: Multiple sales in TakePOS
|
||||
NEW: multiselect categorie client stats facturation
|
||||
NEW: no confirm discard ticket if paid
|
||||
NEW: not show linked table on add message action
|
||||
NEW: only auto print paid ticket in cash desk
|
||||
NEW: only show units columns in product list (not in service list)
|
||||
NEW: order list: enable multicurrency columns
|
||||
NEW: Overwrite tpl with module_part['tpl'] is deprecated. USe hooks
|
||||
NEW: possibility to defined rounding rules by currency
|
||||
NEW: possibility to show society info when print page
|
||||
NEW: Povide a RSS Feed for blogposts
|
||||
NEW: PRODUCT_SHOW_ORIGIN_IN_COMBO
|
||||
NEW: Project task list, add column selector and extrafields
|
||||
NEW: Propal list - Add date start & date end
|
||||
NEW: propal list: enable multicurrency columns
|
||||
NEW: RECEIPT_PRINTER_NB_CHARACT_BY_LINE and FIX: product label
|
||||
NEW: Restore version of application on main screen (for screenshots)
|
||||
NEW: Salaries list - Add date start & date end
|
||||
NEW: search on key code "enter" if defined in TakePOS
|
||||
NEW: set payment method on paid ticket in TakePOS
|
||||
NEW: Show active widget state of a RSS feed
|
||||
NEW: Show count of each category elements in category card
|
||||
NEW: Show creator, last update user of category/tag in the information tab
|
||||
NEW: Show list of users in the user category card
|
||||
NEW: show messages on ticket card
|
||||
NEW: show "New category" button in top of sub categories list
|
||||
NEW: show project label in project index
|
||||
NEW: Show units of products in stocks and hide total units if content is of diffents units
|
||||
NEW: sorting elements on project overview
|
||||
NEW: special option MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION to store in document line created form other documents lines the id of original lines and origin class line rather than origin object id and origin object type
|
||||
NEW: stats invoice graph with 3 bars (3 years instead of 2)
|
||||
NEW: supplier invoice list: enable multicurrency columns
|
||||
NEW: supplier order list: enable multicurrency columns
|
||||
NEW: supplier proposal list: enable multicurrency columns
|
||||
NEW: Support of tag {line_pos} for line numbers for tables in ODT templates
|
||||
NEW: Support some HTML contents into ODT documents
|
||||
NEW: Parameters for Bar Restaurant are grouped in same tab
|
||||
NEW: Takepos : Sort products by reference
|
||||
NEW: Takepos supplements are supported.
|
||||
NEW: The info_admin() can show text after click on other text
|
||||
NEW: The module selection uses a KanBan view by default.
|
||||
NEW: tooltip for Unit_type and scale in "Dictionary setup - Measuring Units"
|
||||
NEW: tooltip notes with first public note and then private note
|
||||
NEW: Tree view for sub-categories
|
||||
NEW: Truncate columns names when too long and show full title as popup
|
||||
NEW: upload odt models for invoices, order, proposal, thirdparties and shipments.
|
||||
NEW: Use native --convert-to feature to convert to pdf
|
||||
NEW: Add user on order list
|
||||
NEW: Various payment list - Add search date start & date end & subledger account
|
||||
NEW: visu FROM day TO day in permonth view
|
||||
NEW: Website logs are now into a separated log file.
|
||||
NEW: X-Axis on graph are shown verticaly when there is a lot of values.
|
||||
NEW: Can force ref of a variant product
|
||||
|
||||
For developers or integrators:
|
||||
|
||||
NEW: Add a method $form->widgetForTranslation to allow any field of a form to be entered into different languages.
|
||||
NEW: Add API to get types of expense reports
|
||||
NEW: API filter bankaccounts by category
|
||||
NEW: API filter contacts by category
|
||||
NEW: API filter members by category
|
||||
NEW: API filter projects by category
|
||||
NEW: API filter thirdpartie by category
|
||||
NEW: API filter thirdparty by category
|
||||
NEW: API filter user by category
|
||||
NEW: API filter warehouses by categorie
|
||||
NEW: api for get user's documents
|
||||
NEW: api invoice get by ref
|
||||
NEW: API to update purchase price.
|
||||
NEW: Move engine to build charts from jflot to chart.js
|
||||
NEW: Upgrade ace to 1.4.8 - Upgrade select2 to 4.0.13
|
||||
NEW: Upgrade Stripe library to 6.43.1
|
||||
NEW: Bookkeeping by account - Add selectfields & hook
|
||||
NEW: Can force position of legend of graph on right (instead of top)
|
||||
NEW: Can change destination of "Back to list" using a "backtolist" parameter
|
||||
NEW: add more category types from hook
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* PHP 5.5 is no more supported. Minimum PHP is now 5.6+.
|
||||
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
|
||||
with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
|
||||
the HTML into content (in such a case, sanitize data later)
|
||||
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests with
|
||||
HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
|
||||
the HTML code of content (in such a case, sanitize data later)
|
||||
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
|
||||
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
|
||||
by a "_" automatically when a reference (with a custom numbering mask that use it) is generated.
|
||||
* Library jflot (replace with chartjs) and geoip (replaced with geoip2) were removed.
|
||||
* Hidden constant COMMANDE_VALID_AFTER_CLOSE_PROPAL were renamed into ORDER_VALID_AFTER_CLOSE_PROPAL.
|
||||
* Library jflot (replace with chartjs) was removed.
|
||||
* Library geoip (replaced with geoip2) was removed.
|
||||
* Hidden constant COMMANDE_VALID_AFTER_CLOSE_PROPAL was renamed into ORDER_VALID_AFTER_CLOSE_PROPAL.
|
||||
* Object field ref_int is deprecated and set to 'not used', method to fetch object by only ref_int is not supported anymore.
|
||||
* UserGroup class has been refactored with new architecture. Triggers of class UserGroup are now USERGROUP_CREATE, USERGROUP_MODIFY, USERGROUP_DELETE
|
||||
* A new way to navigate between pages in list is available. To use it (not mandatory), you must:
|
||||
- replace line $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
|
||||
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste()
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 11.0.4 compared to 11.0.3 *****
|
||||
FIX: #13749
|
||||
FIX: #7594 Expense report multi pagebreak
|
||||
FIX: Access to undeclared static property: Contact::$table_element
|
||||
FIX: actions on supplier proposal not saved (bad trigger name)
|
||||
FIX: Add function "completeTabsHead" to "addreplace" type hook.
|
||||
FIX: All forms must use newToken()
|
||||
FIX: Another "Access to undeclared static property: Contact::$table_element" && "Societe::$table_element"
|
||||
FIX: author search supplier proposal list
|
||||
FIX: A variable was erased by a temporary variable
|
||||
FIX: Avoid infinite loop when a fetch is inside a compute field.
|
||||
FIX: Backto link
|
||||
FIX: Bad position of total in column
|
||||
FIX: bad value in currency into discount created from down payment
|
||||
FIX: buyprice extrafield langfile and tooltip
|
||||
FIX: Buyprice was updated only if min price for this qty had same qty
|
||||
FIX: Can switch from double to price type for extrafields
|
||||
FIX: Can use decimal value in virtual products
|
||||
FIX: child categories only with good entity rights
|
||||
FIX: cloning of emailing when no content selected
|
||||
FIX: closing tags
|
||||
FIX: Combo list of available users to filter on the list of leaves.
|
||||
FIX: Compatibility with multicompany, bad numerotation of task.
|
||||
FIX: consistency of price w/wo vat wrong when price entered with tax
|
||||
FIX: default value of selectMasssAction broken
|
||||
FIX: draftordered replenish virtual stock
|
||||
FIX: Error update SQL into stock reception
|
||||
FIX: expensereport status in generated pdf
|
||||
FIX: extra date field incorrect check
|
||||
FIX: Extrafields of type price must be '' and not '0' if not defined
|
||||
FIX: Foreign currency lost when splitting a discount
|
||||
FIX: get remain to pay with rounding decimals
|
||||
FIX: gzip and bzip2 must use option -f
|
||||
FIX: IHM, unexpected quote
|
||||
FIX: keep viewstatut for doli 3.5
|
||||
FIX: Link missing into email of some notification
|
||||
FIX: Look and feel v11
|
||||
FIX: md stylesheet to be included by external modules like eldy
|
||||
FIX: missing array option
|
||||
FIX: missing default accountancy product buy code
|
||||
FIX: missing fk_bank during export of suppliers invoices
|
||||
FIX: missing member entity
|
||||
FIX: missing selectedlines on supplier order but checkbox are displayed
|
||||
FIX: Missing token and take into account max date when it can.
|
||||
FIX: model export list must be sorted by label
|
||||
FIX: multicurrency manage on hidden conf SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL
|
||||
FIX: Must escape shell
|
||||
FIX: Must exclude logs and some dirs for compressed backup
|
||||
FIX: ordered stock already in $stock
|
||||
FIX: picture migration script from doli 9.0
|
||||
FIX: print pictures on shipment docs
|
||||
FIX: product get purchase prices
|
||||
FIX: product purchase prices
|
||||
FIX: Protection when database has a corrupted product id
|
||||
FIX: remove unused var, $usercancreate can be change by Multicompany
|
||||
FIX: replenish stock to buy
|
||||
FIX: Sanitizing menu parameter
|
||||
FIX: Send email from bulk action of list of thirdparties
|
||||
FIX: setup of suggested payment mode on proposals and orders
|
||||
FIX: Several pb in export of documents
|
||||
FIX: Situation invoice take into account the credit notes.
|
||||
FIX: some others modules (like subtotal) use other product_type than 0 or 1 AND must not be considered in this report
|
||||
FIX: sort by default role makes no sense
|
||||
FIX: sort on company on member list
|
||||
FIX: TakePOS buying price
|
||||
FIX: text version of html emailing (removed the body style)
|
||||
FIX: The "test smtp connectivity" failed on page to setup mass emailing
|
||||
FIX: Error logs an Orderline::delete error, but this is an Orderline::insert error
|
||||
FIX: Translation of tooltips of extrafields
|
||||
FIX: Use getNomURL instead of hard coded link. Fix limit.
|
||||
FIX: Use of image into free text for PDF if DOL_DATA_DIR is outside of
|
||||
FIX: viewstatut to search status
|
||||
FIX: we must export company mail address on contact vcard only if contact email address is empty
|
||||
FIX: when we filter a list on a view status, we want this filter to be on bookmark that we create
|
||||
FIX: Wrong Sql on getListOfTowns api method
|
||||
FIX: wrong user right's name to top menu "commercial"
|
||||
FIX: XSS Vulnerability reported by Mehmet Kelepçe / Gais Cyber Security
|
||||
|
||||
***** ChangeLog for 11.0.3 compared to 11.0.2 *****
|
||||
FIX: unit price for selected supplier products not set. NaN was used.
|
||||
FIX: use bad var to check if total is positive for each VAT rate when validating an invoice
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ FROM php:7.2-apache
|
|||
ENV HOST_USER_ID 33
|
||||
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||
|
||||
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\
|
||||
RUN apt-get update && apt-get install -y libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++\
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
||||
&& docker-php-ext-install gd \
|
||||
|
|
@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev lib
|
|||
&& docker-php-ext-install calendar \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install intl \
|
||||
&& apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++
|
||||
&& apt-get autoremove --purge -y libpng-dev libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++
|
||||
|
||||
RUN mkdir /var/documents
|
||||
RUN chown www-data /var/documents
|
||||
|
|
|
|||
|
|
@ -21,5 +21,12 @@ web:
|
|||
- ../../htdocs:/var/www/html
|
||||
links:
|
||||
- mariadb
|
||||
- mail
|
||||
ports:
|
||||
- "80:80"
|
||||
|
||||
mail:
|
||||
image: maildev/maildev
|
||||
ports:
|
||||
- "8081:80"
|
||||
- "25:25"
|
||||
|
|
@ -110,7 +110,7 @@ print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
|
|||
print "Include custom in signature : ".$includecustom."\n";
|
||||
print "Include constants in signature : ";
|
||||
foreach ($includeconstants as $countrycode => $tmp) {
|
||||
foreach($tmp as $constname => $constvalue) {
|
||||
foreach ($tmp as $constname => $constvalue) {
|
||||
print $constname.'='.$constvalue." ";
|
||||
}
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now
|
|||
|
||||
foreach ($includeconstants as $countrycode => $tmp) {
|
||||
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
|
||||
foreach($tmp as $constname => $constvalue) {
|
||||
foreach ($tmp as $constname => $constvalue) {
|
||||
$valueforchecksum=(empty($constvalue)?'0':$constvalue);
|
||||
$checksumconcat[]=$valueforchecksum;
|
||||
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use Term::ANSIColor;
|
|||
# Change this to defined target for option 98 and 99
|
||||
$PROJECT="dolibarr";
|
||||
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
|
||||
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
||||
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files";
|
||||
|
||||
|
||||
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||
|
|
|
|||
|
|
@ -87,14 +87,11 @@ if ($idobject > 0)
|
|||
// Change status to validated
|
||||
$result=$obj->validate($user);
|
||||
if ($result > 0) print "OK Object created with id ".$idobject."\n";
|
||||
else
|
||||
{
|
||||
else {
|
||||
$error++;
|
||||
dol_print_error($db, $obj->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db, $obj->error);
|
||||
}
|
||||
|
|
@ -106,9 +103,7 @@ if (! $error)
|
|||
{
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '--- end error code='.$error."\n";
|
||||
$db->rollback();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,14 +85,11 @@ if ($idobject > 0)
|
|||
// Change status to validated
|
||||
$result=$com->valid($user);
|
||||
if ($result > 0) print "OK Object created with id ".$idobject."\n";
|
||||
else
|
||||
{
|
||||
else {
|
||||
$error++;
|
||||
dol_print_error($db, $com->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db, $com->error);
|
||||
}
|
||||
|
|
@ -104,9 +101,7 @@ if (! $error)
|
|||
{
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '--- end error code='.$error."\n";
|
||||
$db->rollback();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,7 @@ $idobject = $myproduct->create($user);
|
|||
if ($idobject > 0)
|
||||
{
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db, $myproduct->error);
|
||||
}
|
||||
|
|
@ -95,9 +93,7 @@ if (! $error)
|
|||
{
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '--- end error code='.$error."\n";
|
||||
$db->rollback();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,18 +74,14 @@ if ($idobject > 0)
|
|||
// Change status to validated
|
||||
$result=$obj->setStatut(1);
|
||||
if ($result > 0) print "OK Object created with id ".$idobject."\n";
|
||||
else
|
||||
{
|
||||
else {
|
||||
$error++;
|
||||
dol_print_error($db, $obj->error);
|
||||
}
|
||||
}
|
||||
elseif ($obj->error == 'ErrorLoginAlreadyExists')
|
||||
} elseif ($obj->error == 'ErrorLoginAlreadyExists')
|
||||
{
|
||||
print "User with login ".$obj->login." already exists\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db, $obj->error);
|
||||
}
|
||||
|
|
@ -97,9 +93,7 @@ if (! $error)
|
|||
{
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '--- end error code='.$error."\n";
|
||||
$db->rollback();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,8 +227,7 @@ while ($fields = $db->fetch_array($resql)) {
|
|||
$error++; // $errorrecord will be reset
|
||||
}
|
||||
$j++;
|
||||
} else
|
||||
die("error : $sql");
|
||||
} else die("error : $sql");
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -179,8 +179,7 @@ while ($fields = $db->fetch_array($resql)) {
|
|||
$object->town = trim($fields['FVILLE']);
|
||||
if ($fields['FPAYS'])
|
||||
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
|
||||
else
|
||||
$object->country_id = 1;
|
||||
else $object->country_id = 1;
|
||||
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
|
||||
$object->phone = substr($object->phone, 0, 20);
|
||||
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
|
||||
|
|
@ -299,8 +298,7 @@ while ($fields = $db->fetch_array($resql)) {
|
|||
$contact->town = trim($fields['LVILLE']);
|
||||
if ($fields['FPAYS'])
|
||||
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
|
||||
else
|
||||
$contact->country_id = 1;
|
||||
else $contact->country_id = 1;
|
||||
$contact->email = $fields['LMAIL'];
|
||||
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
|
||||
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
|
||||
|
|
@ -340,8 +338,7 @@ while ($fields = $db->fetch_array($resql)) {
|
|||
$error++; // $errorrecord will be reset
|
||||
}
|
||||
$j++;
|
||||
} else
|
||||
die("error : $sql");
|
||||
} else die("error : $sql");
|
||||
|
||||
$db->commit();
|
||||
|
||||
|
|
|
|||
|
|
@ -207,8 +207,7 @@ class DBase
|
|||
$value = true;
|
||||
elseif ($value == 'f' || $value == 'n')
|
||||
$value = false;
|
||||
else
|
||||
$value = null;
|
||||
else $value = null;
|
||||
}
|
||||
$record[$i] = $value;
|
||||
}
|
||||
|
|
@ -295,8 +294,7 @@ class DBase
|
|||
$i = unpack("S$n", $data);
|
||||
if ($n == 1)
|
||||
return (int) $i[1];
|
||||
else
|
||||
return array_merge($i);
|
||||
else return array_merge($i);
|
||||
}
|
||||
|
||||
private static function putInt16($fd, $value)
|
||||
|
|
@ -310,8 +308,7 @@ class DBase
|
|||
$i = unpack("L$n", $data);
|
||||
if ($n == 1)
|
||||
return (int) $i[1];
|
||||
else
|
||||
return array_merge($i);
|
||||
else return array_merge($i);
|
||||
}
|
||||
|
||||
private static function putInt32($fd, $value)
|
||||
|
|
|
|||
|
|
@ -179,14 +179,10 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
|
|||
if ($result)
|
||||
{
|
||||
print " OK with ref ".$object->ref."\n";;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ if ($resql) {
|
|||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
}
|
||||
}
|
||||
else { print "err"; }
|
||||
} else { print "err"; }
|
||||
|
||||
$commandesid = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande";
|
||||
|
|
@ -138,8 +137,7 @@ if ($resql) {
|
|||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
}
|
||||
}
|
||||
else { print "err"; }
|
||||
} else { print "err"; }
|
||||
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
|
||||
|
|
@ -206,16 +204,12 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
|
|||
{
|
||||
$db->commit();
|
||||
print " OK with ref ".$object->ref."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db, $object->error);
|
||||
|
|
|
|||
|
|
@ -210,16 +210,12 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
|
|||
{
|
||||
$db->commit();
|
||||
print " OK with ref ".$object->ref."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,9 +136,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
|||
}
|
||||
|
||||
print "Company ".$s." created nom=".$soc->name."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "Error: ".$soc->error."\n";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,9 +163,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - Creation OK with ref ".$produit->ref." - id = ".$ret;
|
||||
}
|
||||
|
||||
|
|
@ -180,9 +178,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - updatePrice OK";
|
||||
}
|
||||
}
|
||||
|
|
@ -200,9 +196,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - setMultiLangs OK";
|
||||
}
|
||||
}
|
||||
|
|
@ -227,9 +221,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
|
|||
{
|
||||
print "Rollback any changes.\n";
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "Commit all changes.\n";
|
||||
$db->commit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,9 +181,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - Creation OK with name ".$object->name." - id = ".$ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -212,9 +210,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - create link sale representative OK";
|
||||
}
|
||||
}
|
||||
|
|
@ -243,9 +239,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - create contact OK";
|
||||
}
|
||||
}
|
||||
|
|
@ -277,9 +271,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - create contact OK";
|
||||
}
|
||||
}
|
||||
|
|
@ -305,9 +297,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
|
|||
{
|
||||
print "Rollback any changes.\n";
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "Commit all changes.\n";
|
||||
$db->commit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,9 +142,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||
{
|
||||
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
|
||||
$errorrecord++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " - Creation OK with login ".$object->login." - id = ".$ret;
|
||||
}
|
||||
|
||||
|
|
@ -168,9 +166,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
|
|||
{
|
||||
print "Rollback any changes.\n";
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "Commit all changes.\n";
|
||||
$db->commit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ if (empty($option))
|
|||
if ($option != 'all')
|
||||
{
|
||||
$listofoptions=explode(',', $option);
|
||||
foreach($listofoptions as $cursoroption)
|
||||
foreach ($listofoptions as $cursoroption)
|
||||
{
|
||||
if (! in_array($cursoroption, array_keys($sqls))) {
|
||||
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||
|
|
@ -264,7 +264,7 @@ function processfamily($family, $date)
|
|||
global $db, $sqls;
|
||||
|
||||
$error=0;
|
||||
foreach($sqls[$family] as $sql)
|
||||
foreach ($sqls[$family] as $sql)
|
||||
{
|
||||
if (preg_match('/^@/', $sql))
|
||||
{
|
||||
|
|
@ -302,10 +302,10 @@ function processfamily($family, $date)
|
|||
$db->begin();
|
||||
|
||||
$listofoptions=explode(',', $option);
|
||||
foreach($listofoptions as $cursoroption)
|
||||
foreach ($listofoptions as $cursoroption)
|
||||
{
|
||||
$oldfamily='';
|
||||
foreach($sqls as $family => $familysql)
|
||||
foreach ($sqls as $family => $familysql)
|
||||
{
|
||||
if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) continue;
|
||||
|
||||
|
|
@ -325,9 +325,7 @@ if ($error || $mode != 'confirm')
|
|||
{
|
||||
print "\nRollback any changes.\n";
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "Commit all changes.\n";
|
||||
$db->commit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,8 +95,7 @@ if ($connection)
|
|||
dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR);
|
||||
exit(-5);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//$stream = ssh2_exec($connection, '/usr/bin/php -i');
|
||||
/*
|
||||
print "Generate dump ".$filesys1.'.bz2'."\n";
|
||||
|
|
@ -125,14 +124,13 @@ if ($connection)
|
|||
$return_var=0;
|
||||
print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n";
|
||||
exec($fullcommand, $output, $return_var);
|
||||
foreach($output as $line) print $line."\n";
|
||||
foreach ($output as $line) print $line."\n";
|
||||
|
||||
//ssh2_sftp_unlink($sftp, $fileinstalllock);
|
||||
//print $output;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
print 'Failed to connect to ssh2 to '.$server;
|
||||
exit(-6);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ while ($year <= $currentyear)
|
|||
|
||||
if ($delta1)
|
||||
{
|
||||
foreach($tables as $tablekey => $tableval)
|
||||
foreach ($tables as $tablekey => $tableval)
|
||||
{
|
||||
print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
|
||||
$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
|
||||
|
|
@ -105,7 +105,7 @@ while ($year <= $currentyear)
|
|||
print ".";
|
||||
$sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
|
||||
$j=0;
|
||||
foreach($tableval as $field)
|
||||
foreach ($tableval as $field)
|
||||
{
|
||||
if ($j) $sql2.=", ";
|
||||
$sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
<!-- Rules from Generic Standard -->
|
||||
|
||||
|
||||
<!-- We want to allow empty statement: It allows to put some code comments into the else for examples -->
|
||||
<rule ref="Generic.CodeAnalysis.EmptyStatement">
|
||||
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/>
|
||||
|
|
@ -101,7 +101,7 @@
|
|||
<property name="error" value="false"/>
|
||||
</properties>
|
||||
</rule>
|
||||
-->
|
||||
-->
|
||||
<!-- We want to allow 'if () { ...small code... }' on same line for better code compacity and readability -->
|
||||
<rule ref="Generic.Formatting.DisallowMultipleStatements">
|
||||
<severity>0</severity>
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
</properties>
|
||||
</rule>
|
||||
-->
|
||||
|
||||
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast" />
|
||||
|
||||
<rule ref="Generic.Functions.CallTimePassByReference" />
|
||||
|
|
@ -188,8 +188,8 @@
|
|||
</rule>
|
||||
|
||||
<!-- Check for duplicate class names -->
|
||||
<!-- Disabled: We need this for dependency injection.
|
||||
<rule ref="Generic.Classes.DuplicateClassName" />
|
||||
<!-- Disabled: We need this for dependency injection.
|
||||
<rule ref="Generic.Classes.DuplicateClassName" />
|
||||
-->
|
||||
|
||||
|
||||
|
|
@ -213,6 +213,10 @@
|
|||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
|
||||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
|
||||
|
||||
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> -->
|
||||
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
|
||||
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
|
||||
|
||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
|
||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
|
||||
|
||||
|
|
@ -272,12 +276,7 @@
|
|||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
|
||||
</rule>
|
||||
|
||||
|
||||
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.WrongStyle" />
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingBeforeParamType">
|
||||
<severity>0</severity>
|
||||
|
|
@ -310,20 +309,21 @@
|
|||
<!-- Test if () are removed for includes -->
|
||||
<rule ref="PEAR.Files.IncludingFile" />
|
||||
|
||||
<!-- Disable some error messages that we do not want. -->
|
||||
|
||||
<!-- We disable this: We must be able to make require inside if -->
|
||||
<rule ref="PEAR.Files.IncludingFile.UseInclude">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<!-- TODO Enable this test. We should use require for include in prior of include when out of if -->
|
||||
|
||||
<!-- We disable this. We must be allowed to use strict require instead of non strict include anywhere -->
|
||||
<rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Files.IncludingFile.UseRequire">
|
||||
<severity>0</severity>
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- TODO Enable this test. We should use require for include in prior of include when out of if -->
|
||||
|
||||
<!-- We disable this: We want to allow include_once -->
|
||||
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
|
@ -332,27 +332,25 @@
|
|||
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature" />
|
||||
|
||||
<!-- TODO Enable this test. -->
|
||||
<!-- We disable this: It returns a lot of false positive -->
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- TODO Enable this test. -->
|
||||
|
||||
<!-- We disable this: We want to allow small function on 1 line -->
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine" />
|
||||
|
||||
<!-- We disable this: Too many false positive -->
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.Indent">
|
||||
<severity>0</severity>
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeOpenBracket">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterCloseBracket">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeOpenBracket" />
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterCloseBracket" />
|
||||
|
||||
<rule ref="PEAR.Functions.ValidDefaultValue" />
|
||||
|
||||
|
|
@ -361,26 +359,26 @@
|
|||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<!-- We disable this: there is a lot of existing method not starting with a capital letter (class modXxxx, ...) -->
|
||||
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCapital">
|
||||
<severity>0</severity>
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- some phpcs have a typo error in rule, so we add it too -->
|
||||
<!-- some phpcs have a typo error in rule, so we add it this rule too with term "Captial" instead of "Capital" -->
|
||||
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore" />
|
||||
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- We disable this: there is a lot of existing function not starting with a capital letter (class modXxxx, ...) -->
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCapital">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- some phpcs have a typo error in rule, so we add it too -->
|
||||
<!-- some phpcs have a typo error in rule, so we add it this rule too with term "Captial" instead of "Capital" -->
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
|
@ -391,16 +389,16 @@
|
|||
<!--<rule ref="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
|
||||
<severity>0</severity>
|
||||
</rule>-->
|
||||
|
||||
<!-- We disable this: We don't want to have private methods prefixed with an underscore -->
|
||||
<rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.NamingConventions.ValidVariableName" />
|
||||
|
||||
<rule ref="PSR2.Classes.ClassDeclaration" />
|
||||
<rule ref="PSR2.Methods.FunctionClosingBrace" />
|
||||
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed" />
|
||||
|
||||
<!-- This is not in PSR2 -->
|
||||
<!-- We disable this: We don't want to have private methods prefixed with an underscore -->
|
||||
<rule ref="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
|
@ -411,7 +409,6 @@
|
|||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
|
@ -421,15 +418,17 @@
|
|||
<!-- <rule ref="PEAR.WhiteSpace.ScopeIndent" /> -->
|
||||
|
||||
|
||||
<!-- Rules from Zend Standard-->
|
||||
|
||||
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
|
||||
<rule ref="Zend.Files.ClosingTag"/>
|
||||
|
||||
<!-- Rules PSR 2 -->
|
||||
<rule ref="PSR2.Classes.ClassDeclaration" />
|
||||
<rule ref="PSR2.Methods.FunctionClosingBrace" />
|
||||
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed" />
|
||||
<rule ref="PSR2.Classes.ClassDeclaration" />
|
||||
<rule ref="PSR2.Methods.FunctionClosingBrace" />
|
||||
<rule ref="PSR2.Files.EndFileNewline.TooMany" />
|
||||
<rule ref="PSR2.Files.EndFileNewline.NoneFound" />
|
||||
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket" />
|
||||
<rule ref="PSR2.Classes.PropertyDeclaration.VarUsed" />
|
||||
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
|
||||
<rule ref="PSR2.Files.ClosingTag"/>
|
||||
|
||||
</ruleset>
|
||||
|
|
|
|||
|
|
@ -76,14 +76,12 @@ function getfieldname($l)
|
|||
if (preg_match("/`(.*)`/", $l, $regs)) {
|
||||
if ($regs[1])
|
||||
return $regs[1];
|
||||
else
|
||||
return null;
|
||||
else return null;
|
||||
} // if its not in quotes, then it should (we hope!) be the first "word" on the line, up to the first space.
|
||||
elseif (preg_match("/([^\ ]*)/", trim($l), $regs)) {
|
||||
if ($regs[1])
|
||||
return $regs[1];
|
||||
else
|
||||
return null;
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -102,8 +100,7 @@ function formatsize($s)
|
|||
return sprintf("%.1f", round($s / 1024, 1)) . "K";
|
||||
elseif ($s < pow(2, 30))
|
||||
return sprintf("%.1f", round($s / 1024 / 1024, 1)) . "M";
|
||||
else
|
||||
return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G";
|
||||
else return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -146,8 +143,7 @@ function pg2mysql_large($infilename, $outfilename)
|
|||
if ($c % 2 != 0) {
|
||||
if ($inquotes)
|
||||
$inquotes = false;
|
||||
else
|
||||
$inquotes = true;
|
||||
else $inquotes = true;
|
||||
}
|
||||
|
||||
if ($linenum % 10000 == 0) {
|
||||
|
|
@ -329,8 +325,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
|||
$num = $regs[1];
|
||||
if ($num <= 255)
|
||||
$line = preg_replace("/ character varying\([0-9]*\)/", " varchar($num)", $line);
|
||||
else
|
||||
$line = preg_replace("/ character varying\([0-9]*\)/", " text", $line);
|
||||
else $line = preg_replace("/ character varying\([0-9]*\)/", " text", $line);
|
||||
}
|
||||
// character varying with no size, we will default to varchar(255)
|
||||
if (preg_match("/ character varying/", $line)) {
|
||||
|
|
@ -352,8 +347,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
|||
$num = $regs[1];
|
||||
if ($num <= 255)
|
||||
$line = preg_replace("/ character\([0-9]*\)/", " varchar($num)", $line);
|
||||
else
|
||||
$line = preg_replace("/ character\([0-9]*\)/", " text", $line);
|
||||
else $line = preg_replace("/ character\([0-9]*\)/", " text", $line);
|
||||
}
|
||||
// timestamps
|
||||
$line = str_replace(" timestamp with time zone", " datetime", $line);
|
||||
|
|
@ -465,8 +459,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
|||
if ($c % 2 != 0) {
|
||||
if ($inquotes)
|
||||
$inquotes = false;
|
||||
else
|
||||
$inquotes = true;
|
||||
else $inquotes = true;
|
||||
// echo "inquotes=$inquotes\n";
|
||||
}
|
||||
} while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class autoTranslator
|
|||
|
||||
$files = $this->getTranslationFilesArray($this->_refLang);
|
||||
$counter = 1;
|
||||
foreach($files as $file)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if ($this->_limittofile && $this->_limittofile != $file) continue;
|
||||
$counter++;
|
||||
|
|
@ -94,7 +94,7 @@ class autoTranslator
|
|||
|
||||
// If we must process all languages
|
||||
$arraytmp=dol_dir_list($this->_langDir, 'directories', 0);
|
||||
foreach($arraytmp as $dirtmp)
|
||||
foreach ($arraytmp as $dirtmp)
|
||||
{
|
||||
if ($dirtmp['name'] === $this->_refLang) continue; // We discard source language
|
||||
$tmppart=explode('_', $dirtmp['name']);
|
||||
|
|
@ -112,7 +112,7 @@ class autoTranslator
|
|||
}
|
||||
|
||||
// Process translation of source file for each target languages
|
||||
foreach($targetlangs as $my_destlang)
|
||||
foreach ($targetlangs as $my_destlang)
|
||||
{
|
||||
$this->_translatedFiles = array();
|
||||
|
||||
|
|
@ -124,15 +124,14 @@ class autoTranslator
|
|||
echo "File not found: " . $destPath . ". We generate it.<br>\n";
|
||||
$this->createTranslationFile($destPath, $my_destlang);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
echo "Updating file: " . $destPath . "<br>\n";
|
||||
}
|
||||
|
||||
// Translate lines
|
||||
$fileContentDest = file($destPath, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
|
||||
$newlines=0;
|
||||
foreach($fileContent as $line){
|
||||
foreach ($fileContent as $line){
|
||||
$key = $this->getLineKey($line);
|
||||
$value = $this->getLineValue($line);
|
||||
if ($key && $value)
|
||||
|
|
@ -167,7 +166,7 @@ class autoTranslator
|
|||
fwrite($fp, "\n");
|
||||
fwrite($fp, "// START - Lines generated via autotranslator.php tool (".$this->_time.").\n");
|
||||
fwrite($fp, "// Reference language: ".$this->_refLang." -> ".$my_destlang."\n");
|
||||
foreach($this->_translatedFiles[$file] as $line) {
|
||||
foreach ($this->_translatedFiles[$file] as $line) {
|
||||
fwrite($fp, $line . "\n");
|
||||
}
|
||||
fwrite($fp, "// STOP - Lines generated via autotranslator.php tool (".$this->_time_end.").\n");
|
||||
|
|
@ -209,7 +208,7 @@ class autoTranslator
|
|||
{
|
||||
|
||||
//print "key =".$key."\n";
|
||||
foreach($content as $line) {
|
||||
foreach ($content as $line) {
|
||||
$destKey = $this->getLineKey($line);
|
||||
$destValue = $this->getLineValue($line);
|
||||
// If translated return
|
||||
|
|
@ -273,8 +272,8 @@ class autoTranslator
|
|||
private function getTranslationFilesArray($lang)
|
||||
{
|
||||
$dir = new DirectoryIterator($this->_langDir.$lang);
|
||||
while($dir->valid()) {
|
||||
if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) {
|
||||
while ($dir->valid()) {
|
||||
if (!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) {
|
||||
$files[] = $dir->getFilename();
|
||||
}
|
||||
$dir->next();
|
||||
|
|
|
|||
|
|
@ -360,16 +360,14 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||
$unused[$value] = $line;
|
||||
echo $line; // $trad contains the \n
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
unset($output);
|
||||
//print 'X'.$output.'Y';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($unused)) print "No string not used found.\n";
|
||||
else
|
||||
{
|
||||
else {
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
file_put_contents($filetosave, implode("", $unused));
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ $aEnglish = array();
|
|||
if ($filesToProcess == 'all')
|
||||
{
|
||||
$dir = new DirectoryIterator('htdocs/langs/'.$lPrimary);
|
||||
while($dir->valid()) {
|
||||
if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) {
|
||||
while ($dir->valid()) {
|
||||
if (!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) {
|
||||
$files[] = $dir->getFilename();
|
||||
}
|
||||
$dir->next();
|
||||
|
|
@ -94,7 +94,7 @@ else $filesToProcess=explode(',', $filesToProcess);
|
|||
|
||||
|
||||
// Loop on each file
|
||||
foreach($filesToProcess as $fileToProcess)
|
||||
foreach ($filesToProcess as $fileToProcess)
|
||||
{
|
||||
$lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess;
|
||||
$lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess;
|
||||
|
|
@ -250,11 +250,11 @@ foreach($filesToProcess as $fileToProcess)
|
|||
{
|
||||
if ( ! $oh = fopen($output, 'w') )
|
||||
{
|
||||
print "ERROR in writing to file $output\n";
|
||||
print "ERROR in writing to file ".$output."\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
print "Read Primary File $lPrimaryFile and write ".$output.":\n";
|
||||
print "Read Primary File ".$lPrimaryFile." and write ".$output.":\n";
|
||||
|
||||
fwrite($oh, "# Dolibarr language file - Source file is en_US - ".(preg_replace('/\.lang$/', '', $fileToProcess))."\n");
|
||||
|
||||
|
|
@ -285,8 +285,7 @@ foreach($filesToProcess as $fileToProcess)
|
|||
print "Key $key is redundant in file $lPrimaryFile (line: $cnt) - Already found into ".$fileFirstFound[$key]." (line: ".$lineFirstFound[$key].").\n";
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$fileFirstFound[$key] = $fileToProcess;
|
||||
$lineFirstFound[$key] = $cnt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,16 @@ if [ "x$1" = "xall" ]
|
|||
then
|
||||
if [ "x$2" = "x" ]
|
||||
then
|
||||
echo "tx pull"
|
||||
tx pull
|
||||
echo "tx pull -a"
|
||||
tx pull -a
|
||||
|
||||
echo "Remove some language directories (not enough translated)"
|
||||
rm -fr htdocs/langs/ach
|
||||
rm -fr htdocs/langs/br_FR
|
||||
rm -fr htdocs/langs/en
|
||||
rm -fr htdocs/langs/frp
|
||||
rm -fr htdocs/langs/fy_NL
|
||||
|
||||
else
|
||||
for dir in `find htdocs/langs/* -type d`
|
||||
do
|
||||
|
|
|
|||
|
|
@ -119,8 +119,7 @@ if (empty($reshook))
|
|||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$country_code = $obj->code;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
|
||||
// Try to load sql file
|
||||
if ($country_code)
|
||||
|
|
@ -143,9 +142,7 @@ if (empty($reshook))
|
|||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +158,7 @@ if (empty($reshook))
|
|||
if ($action == 'disable') {
|
||||
if ($accounting->fetch($id)) {
|
||||
$mode = GETPOST('mode', 'int');
|
||||
$result = $accounting->account_desactivate($id, $mode);
|
||||
$result = $accounting->accountDeactivate($id, $mode);
|
||||
}
|
||||
|
||||
$action = 'update';
|
||||
|
|
@ -235,8 +232,7 @@ if (strlen(trim($search_account))) {
|
|||
}
|
||||
$sql .= " AND (aa.account_number LIKE '".$startchar.$search_account_tmp_clean."'";
|
||||
$sql .= " OR aa.account_number LIKE '".$startchar.$search_account_clean."%')";
|
||||
}
|
||||
else $sql .= natural_search("aa.account_number", $search_account_tmp);
|
||||
} else $sql .= natural_search("aa.account_number", $search_account_tmp);
|
||||
}
|
||||
}
|
||||
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
||||
|
|
@ -267,7 +263,7 @@ if ($resql)
|
|||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = '';
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||
|
|
@ -328,8 +324,7 @@ if ($resql)
|
|||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
print "</select>";
|
||||
print ajax_combobox("chartofaccounts");
|
||||
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
|
|
@ -431,9 +426,7 @@ if ($resql)
|
|||
print $accountparent->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,8 +228,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
|
||||
}
|
||||
elseif ($value == 'entity') {
|
||||
} elseif ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
|
|
@ -245,13 +244,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -260,8 +256,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
|
|
@ -276,8 +271,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
|
||||
}
|
||||
elseif ($field == 'entity') {
|
||||
} elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
|
|
@ -306,8 +300,7 @@ if (GETPOST('actioncancel', 'alpha'))
|
|||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
|
|
@ -318,9 +311,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -329,13 +320,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||
}
|
||||
|
||||
|
|
@ -349,13 +338,11 @@ if ($action == $acts[0])
|
|||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||
}
|
||||
|
||||
|
|
@ -369,13 +356,11 @@ if ($action == $acts[1])
|
|||
// favorite
|
||||
if ($action == 'activate_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$code."'";
|
||||
}
|
||||
|
||||
|
|
@ -389,13 +374,11 @@ if ($action == 'activate_favorite')
|
|||
// disable favorite
|
||||
if ($action == 'disable_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$code."'";
|
||||
}
|
||||
|
||||
|
|
@ -581,9 +564,7 @@ if ($id)
|
|||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
}
|
||||
|
|
@ -629,9 +610,7 @@ if ($id)
|
|||
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -652,26 +631,20 @@ if ($id)
|
|||
if ($value == 'element')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
elseif ($value == 'source')
|
||||
} elseif ($value == 'source')
|
||||
{
|
||||
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
elseif ($valuetoshow == 'all') {
|
||||
} elseif ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country') {
|
||||
} elseif ($fieldlist[$field] == 'country') {
|
||||
if (empty($obj->country_code))
|
||||
{
|
||||
$valuetoshow = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$key = $langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id') {
|
||||
} elseif ($fieldlist[$field] == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
||||
|
|
@ -708,8 +681,7 @@ if ($id)
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
@ -761,8 +733,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
|||
$fieldname = 'country';
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id')
|
||||
} elseif ($fieldlist[$field] == 'country_id')
|
||||
{
|
||||
if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
{
|
||||
|
|
@ -771,8 +742,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
|||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type_cdr') {
|
||||
} elseif ($fieldlist[$field] == 'type_cdr') {
|
||||
if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
|
||||
else print '<td>';
|
||||
if ($fieldlist[$field] == 'type_cdr') {
|
||||
|
|
@ -781,12 +751,9 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
|||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $size = 'size="8" ';
|
||||
|
|
|
|||
|
|
@ -75,18 +75,14 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
|
||||
{
|
||||
$account_number = GETPOST('account_number', 'string');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$account_number = clean_account(GETPOST('account_number', 'string'));
|
||||
}
|
||||
|
||||
if (GETPOST('account_parent', 'int') <= 0)
|
||||
{
|
||||
$account_parent = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$account_parent = GETPOST('account_parent', 'int');
|
||||
}
|
||||
|
||||
|
|
@ -104,13 +100,11 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||
$error = 1;
|
||||
$action = "create";
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
elseif ($res == - 4) {
|
||||
} elseif ($res == - 4) {
|
||||
$error = 2;
|
||||
$action = "create";
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
elseif ($res < 0)
|
||||
} elseif ($res < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
@ -140,18 +134,14 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
|
||||
{
|
||||
$account_number = GETPOST('account_number', 'string');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$account_number = clean_account(GETPOST('account_number', 'string'));
|
||||
}
|
||||
|
||||
if (GETPOST('account_parent', 'int') <= 0)
|
||||
{
|
||||
$account_parent = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$account_parent = GETPOST('account_parent', 'int');
|
||||
}
|
||||
|
||||
|
|
@ -269,8 +259,7 @@ if ($action == 'create') {
|
|||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
elseif ($id > 0 || $ref) {
|
||||
} elseif ($id > 0 || $ref) {
|
||||
$result = $object->fetch($id, $ref, 1);
|
||||
|
||||
if ($result > 0) {
|
||||
|
|
|
|||
|
|
@ -235,13 +235,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -250,8 +247,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
|
|
@ -266,8 +262,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
if ($field == 'fk_country' && $_POST['country'] > 0) {
|
||||
$_POST[$listfieldvalue[$i]] = $_POST['country'];
|
||||
}
|
||||
elseif ($field == 'entity') {
|
||||
} elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
|
|
@ -296,8 +291,7 @@ if (GETPOST('actioncancel', 'alpha'))
|
|||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
|
||||
|
|
@ -308,9 +302,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -319,13 +311,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code = '".$db->escape($code)."'";
|
||||
}
|
||||
|
||||
|
|
@ -339,13 +329,11 @@ if ($action == $acts[0])
|
|||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code = '".$db->escape($code)."'";
|
||||
}
|
||||
|
||||
|
|
@ -359,13 +347,11 @@ if ($action == $acts[1])
|
|||
// favorite
|
||||
if ($action == 'activate_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape($code)."'";
|
||||
}
|
||||
|
||||
|
|
@ -379,13 +365,11 @@ if ($action == 'activate_favorite')
|
|||
// disable favorite
|
||||
if ($action == 'disable_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape($code)."'";
|
||||
}
|
||||
|
||||
|
|
@ -597,9 +581,7 @@ if ($id)
|
|||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
$filterfound++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
}
|
||||
|
|
@ -726,10 +708,8 @@ if ($id)
|
|||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
|
@ -745,35 +725,27 @@ if ($id)
|
|||
if ($value == 'category_type')
|
||||
{
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
}
|
||||
elseif ($valuetoshow == 'all') {
|
||||
} elseif ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country') {
|
||||
} elseif ($fieldlist[$field] == 'country') {
|
||||
if (empty($obj->country_code))
|
||||
{
|
||||
$valuetoshow = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$key = $langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
|
||||
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
|
||||
$key = $langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
|
||||
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
|
||||
$langs->loadLangs(array("propal"));
|
||||
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
} elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key = $langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
|
||||
} elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
||||
|
|
@ -799,8 +771,7 @@ if ($id)
|
|||
// Active
|
||||
print '<td class="center" class="nowrap">';
|
||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
else
|
||||
{
|
||||
else {
|
||||
print $langs->trans("AlwaysActive");
|
||||
}
|
||||
print "</td>";
|
||||
|
|
@ -816,8 +787,7 @@ if ($id)
|
|||
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
} else print '<td> </td>';
|
||||
|
||||
// Link to setup the group
|
||||
print '<td class="center">';
|
||||
|
|
@ -833,8 +803,7 @@ if ($id)
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
@ -882,14 +851,11 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
|||
{
|
||||
$fieldname = 'country_id';
|
||||
print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id')
|
||||
} elseif ($fieldlist[$field] == 'country_id')
|
||||
{
|
||||
if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
{
|
||||
|
|
@ -898,17 +864,13 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
|||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'category_type') {
|
||||
} elseif ($fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $class = 'maxwidth100';
|
||||
|
|
|
|||
|
|
@ -193,8 +193,7 @@ foreach ($list_account as $key) {
|
|||
$reg = array();
|
||||
if (preg_match('/---(.*)---/', $key, $reg)) {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans($reg[1]).'</td><td></td></tr>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
|
|
|
|||
|
|
@ -71,9 +71,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
|
|||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'add') {
|
||||
} elseif ($action == 'add') {
|
||||
if (!GETPOST('cancel', 'alpha')) {
|
||||
$error = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -238,13 +238,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -253,8 +250,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
|
|
@ -269,8 +265,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
{
|
||||
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
|
||||
}
|
||||
elseif ($field == 'entity') {
|
||||
} elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
|
|
@ -300,8 +295,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -313,9 +307,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -324,13 +316,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||
}
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -345,13 +335,11 @@ if ($action == $acts[0])
|
|||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($code) {
|
||||
} elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||
}
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -595,9 +583,7 @@ if ($id)
|
|||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -614,12 +600,10 @@ if ($id)
|
|||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
if ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$key = $langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||
$valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$valuetoshow = $langs->trans($obj->label);
|
||||
}
|
||||
|
||||
|
|
@ -667,8 +651,7 @@ if ($id)
|
|||
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
} else print '<td> </td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
|
|
@ -679,8 +662,7 @@ if ($id)
|
|||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
@ -724,12 +706,9 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
|||
print '<td>';
|
||||
print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $class = 'maxwidth100';
|
||||
|
|
|
|||
|
|
@ -252,25 +252,19 @@ $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
|
||||
{
|
||||
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
{
|
||||
$sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
{
|
||||
$sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
|
||||
{
|
||||
$sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
|
|
@ -290,13 +284,11 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
|||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
|
||||
}
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
|
||||
}
|
||||
|
|
@ -492,34 +484,27 @@ if ($result)
|
|||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell_export;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
|
|
@ -530,34 +515,27 @@ if ($result)
|
|||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_export;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_export;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
|
|
@ -620,7 +598,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);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
// Accounting account buy intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
|
|
@ -630,7 +608,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);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
// Accounting account buy export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ $pagenext = $page + 1;
|
|||
//if (! $sortfield) $sortfield="p.date_fin";
|
||||
//if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
|
||||
$show_subgroup = GETPOST('show_subgroup', 'alpha');
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
|
|
@ -130,10 +130,11 @@ if (!empty($search_accountancy_code_end)) {
|
|||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$show_subgroup = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$filter = array();
|
||||
}
|
||||
|
||||
|
|
@ -223,6 +224,12 @@ if ($action != 'export_csv')
|
|||
$moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0);
|
||||
$moreforfilter .= $langs->trans('DateEnd').': ';
|
||||
$moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0);
|
||||
|
||||
$moreforfilter .= ' - ';
|
||||
$moreforfilter .= $langs->trans('ShowSubtotalByGroup').': ';
|
||||
$moreforfilter .= '<input type="checkbox" name="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
|
||||
|
||||
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
if (!empty($moreforfilter)) {
|
||||
|
|
@ -289,26 +296,31 @@ if ($action != 'export_csv')
|
|||
}
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Permet d'afficher le compte comptable
|
||||
if (empty($displayed_account) || $root_account_description != $displayed_account)
|
||||
if (!empty($show_subgroup))
|
||||
{
|
||||
// Affiche un Sous-Total par compte comptable
|
||||
if ($displayed_account != "") {
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
|
||||
print "<td> </td>\n";
|
||||
// Show accounting account
|
||||
if (empty($displayed_account) || $root_account_description != $displayed_account) {
|
||||
// Show subtotal per accounting account
|
||||
if ($displayed_account != "") {
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("SubTotal").':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_description;
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
}
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_description;
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
}
|
||||
|
||||
// $object->get_compte_racine($line->numero_compte);
|
||||
|
||||
print '<td>'.length_accountg($line->numero_compte).'</td>';
|
||||
|
|
@ -326,12 +338,15 @@ if ($action != 'export_csv')
|
|||
$sous_total_credit += $line->credit;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
if (!empty($show_subgroup))
|
||||
{
|
||||
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
|
|
|||
|
|
@ -138,9 +138,7 @@ if ($action == "confirm_update") {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == "add") {
|
||||
} elseif ($action == "add") {
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||
|
|
@ -199,9 +197,7 @@ elseif ($action == "add") {
|
|||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == "confirm_delete") {
|
||||
} elseif ($action == "confirm_delete") {
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
$result = $object->fetch($id, null, $mode);
|
||||
|
|
@ -216,9 +212,7 @@ elseif ($action == "confirm_delete") {
|
|||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
elseif ($action == "confirm_create") {
|
||||
} elseif ($action == "confirm_create") {
|
||||
$error = 0;
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
|
@ -438,7 +432,7 @@ if ($action == 'create')
|
|||
print $langs->trans('Docdate');
|
||||
print '</td>';
|
||||
if ($action != 'editdate')
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
|
||||
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate') {
|
||||
|
|
@ -462,7 +456,7 @@ if ($action == 'create')
|
|||
print $langs->trans('Codejournal');
|
||||
print '</td>';
|
||||
if ($action != 'editjournal')
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
|
||||
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editjournal') {
|
||||
|
|
@ -486,7 +480,7 @@ if ($action == 'create')
|
|||
print $langs->trans('Piece');
|
||||
print '</td>';
|
||||
if ($action != 'editdocref')
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
|
||||
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editdocref') {
|
||||
|
|
@ -628,9 +622,7 @@ if ($action == 'create')
|
|||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">';
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -650,8 +642,8 @@ if ($action == 'create')
|
|||
print '<td class="nowrap right">'.price($line->credit).'</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">';
|
||||
print img_edit();
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">';
|
||||
print img_edit('', 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
|
||||
$actiontodelete = 'delete';
|
||||
|
|
@ -685,9 +677,7 @@ if ($action == 'create')
|
|||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount('', 'subledger_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="">';
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -707,9 +697,7 @@ if ($action == 'create')
|
|||
if ($total_debit == $total_credit)
|
||||
{
|
||||
print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -351,18 +351,14 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
|
|||
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
}
|
||||
|
||||
// Make a redirect to avoid to launch the delete later after a back button
|
||||
header("Location: list.php".($param ? '?'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
|
@ -373,9 +369,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
|
|||
$result = $object->deleteMvtNum($mvt_num);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
|
|
@ -480,9 +474,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
|||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Export files
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$accountancyexport->export($object->lines, $formatexportset);
|
||||
|
|
@ -490,9 +482,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
|||
if (!empty($accountancyexport->errors))
|
||||
{
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Specify as export : update field date_export
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
|
@ -521,9 +511,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
|||
{
|
||||
$db->commit();
|
||||
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
|
||||
|
|
@ -559,9 +547,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -721,9 +707,7 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
|
|||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
}
|
||||
print '</div>';
|
||||
|
|
@ -734,9 +718,7 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
|
|||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
}
|
||||
print '</div>';
|
||||
|
|
@ -929,8 +911,7 @@ while ($i < min($num, $limit))
|
|||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
}
|
||||
elseif ($line->doc_type == 'supplier_invoice')
|
||||
} elseif ($line->doc_type == 'supplier_invoice')
|
||||
{
|
||||
$langs->loadLangs(array('bills'));
|
||||
|
||||
|
|
@ -943,8 +924,7 @@ while ($i < min($num, $limit))
|
|||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
|
||||
}
|
||||
elseif ($line->doc_type == 'expense_report')
|
||||
} elseif ($line->doc_type == 'expense_report')
|
||||
{
|
||||
$langs->loadLangs(array('trips'));
|
||||
|
||||
|
|
@ -957,9 +937,7 @@ while ($i < min($num, $limit))
|
|||
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Other type
|
||||
}
|
||||
|
||||
|
|
@ -1039,7 +1017,7 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ $search_direction = GETPOST('search_direction', 'alpha');
|
|||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||
$search_debit = GETPOST('search_debit', 'alpha');
|
||||
$search_credit = GETPOST('search_credit', 'alpha');
|
||||
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
|
||||
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||
$action = 'delbookkeepingyear';
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
|
|
@ -70,6 +76,13 @@ $pagenext = $page + 1;
|
|||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new BookKeeping($db);
|
||||
$hookmanager->initHooks(array('bookkeepingbyaccountlist'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) {
|
||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||
|
|
@ -96,98 +109,175 @@ if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search
|
|||
}
|
||||
}
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
$arrayfields = array(
|
||||
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
||||
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
|
||||
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
|
||||
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
||||
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
|
||||
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
|
||||
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
|
||||
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
|
||||
);
|
||||
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_label_account = '';
|
||||
$search_doc_ref = '';
|
||||
$search_label_operation = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endday = '';
|
||||
$search_debit = '';
|
||||
$search_credit = '';
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_label_account = '';
|
||||
$search_doc_ref = '';
|
||||
$search_label_operation = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endday = '';
|
||||
$search_debit = '';
|
||||
$search_credit = '';
|
||||
$search_lettering_code = '';
|
||||
$search_not_reconciled = '';
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
$param = '';
|
||||
$filter = array();
|
||||
|
||||
if (!empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$param .= '&search_date_startmonth=' . GETPOST('search_date_startmonth', 'int') . '&search_date_startday=' . GETPOST('search_date_startday', 'int') . '&search_date_startyear=' . GETPOST('search_date_startyear', 'int');
|
||||
}
|
||||
if (!empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$param .= '&search_date_endmonth=' . GETPOST('search_date_endmonth', 'int') . '&search_date_endday=' . GETPOST('search_date_endday', 'int') . '&search_date_endyear=' . GETPOST('search_date_endyear', 'int');
|
||||
}
|
||||
if (!empty($search_doc_date)) {
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
||||
}
|
||||
if (!empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
|
||||
}
|
||||
if (!empty($search_accountancy_code_end)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_label_account)) {
|
||||
$filter['t.label_compte'] = $search_label_account;
|
||||
$param .= '&search_label_compte=' . urlencode($search_label_account);
|
||||
}
|
||||
if (!empty($search_doc_ref)) {
|
||||
$filter['t.doc_ref'] = $search_doc_ref;
|
||||
$param .= '&search_doc_ref=' . urlencode($search_doc_ref);
|
||||
}
|
||||
if (!empty($search_label_operation)) {
|
||||
$filter['t.label_operation'] = $search_label_operation;
|
||||
$param .= '&search_label_operation=' . urlencode($search_label_operation);
|
||||
}
|
||||
if (!empty($search_direction)) {
|
||||
$filter['t.sens'] = $search_direction;
|
||||
$param .= '&search_direction=' . urlencode($search_direction);
|
||||
}
|
||||
if (!empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
$param .= '&search_ledger_code=' . urlencode($search_ledger_code);
|
||||
}
|
||||
if (!empty($search_debit)) {
|
||||
$filter['t.debit'] = $search_debit;
|
||||
$param .= '&search_debit=' . urlencode($search_debit);
|
||||
}
|
||||
if (!empty($search_credit)) {
|
||||
$filter['t.credit'] = $search_credit;
|
||||
$param .= '&search_credit=' . urlencode($search_credit);
|
||||
}
|
||||
if (!empty($search_lettering_code)) {
|
||||
$filter['t.lettering_code'] = $search_lettering_code;
|
||||
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
|
||||
}
|
||||
if (!empty($search_not_reconciled)) {
|
||||
$filter['t.reconciled_option'] = $search_not_reconciled;
|
||||
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
|
||||
}
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
$param = '';
|
||||
$filter = array();
|
||||
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
|
||||
$import_key = GETPOST('importkey', 'alpha');
|
||||
|
||||
if (!empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$param .= '&search_date_startmonth='.GETPOST('search_date_startmonth', 'int').'&search_date_startday='.GETPOST('search_date_startday', 'int').'&search_date_startyear='.GETPOST('search_date_startyear', 'int');
|
||||
}
|
||||
if (!empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$param .= '&search_date_endmonth='.GETPOST('search_date_endmonth', 'int').'&search_date_endday='.GETPOST('search_date_endday', 'int').'&search_date_endyear='.GETPOST('search_date_endyear', 'int');
|
||||
}
|
||||
if (!empty($search_doc_date)) {
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
|
||||
}
|
||||
if (!empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
|
||||
}
|
||||
if (!empty($search_accountancy_code_end)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_label_account)) {
|
||||
$filter['t.label_compte'] = $search_label_account;
|
||||
$param .= '&search_label_compte='.urlencode($search_label_account);
|
||||
}
|
||||
if (!empty($search_doc_ref)) {
|
||||
$filter['t.doc_ref'] = $search_doc_ref;
|
||||
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
|
||||
}
|
||||
if (!empty($search_label_operation)) {
|
||||
$filter['t.label_operation'] = $search_label_operation;
|
||||
$param .= '&search_label_operation='.urlencode($search_label_operation);
|
||||
}
|
||||
if (!empty($search_direction)) {
|
||||
$filter['t.sens'] = $search_direction;
|
||||
$param .= '&search_direction='.urlencode($search_direction);
|
||||
}
|
||||
if (!empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
$param .= '&search_ledger_code='.urlencode($search_ledger_code);
|
||||
}
|
||||
if (!empty($search_debit)) {
|
||||
$filter['t.debit'] = $search_debit;
|
||||
$param .= '&search_debit='.urlencode($search_debit);
|
||||
}
|
||||
if (!empty($search_credit)) {
|
||||
$filter['t.credit'] = $search_credit;
|
||||
$param .= '&search_credit='.urlencode($search_credit);
|
||||
}
|
||||
if (!empty($import_key)) {
|
||||
$result = $object->deleteByImportkey($import_key);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Make a redirect to avoid to launch the delete later after a back button
|
||||
header("Location: listbyaccount.php".($param ? '?'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
||||
$delmonth = GETPOST('delmonth', 'int');
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
if ($delyear == -1) {
|
||||
$delyear = 0;
|
||||
}
|
||||
$deljournal = GETPOST('deljournal', 'alpha');
|
||||
if ($deljournal == -1) {
|
||||
$deljournal = 0;
|
||||
}
|
||||
|
||||
if ($action == 'delmouvconfirm') {
|
||||
if (!empty($delmonth) || !empty($delyear) || !empty($deljournal))
|
||||
{
|
||||
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
}
|
||||
|
||||
// Make a redirect to avoid to launch the delete later after a back button
|
||||
header("Location: listbyaccount.php".($param ? '?'.$param : ''));
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||
}
|
||||
}
|
||||
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
|
||||
$mvt_num = GETPOST('mvt_num', 'int');
|
||||
|
||||
if (!empty($mvt_num)) {
|
||||
$result = $object->deleteMvtNum($mvt_num);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
Header("Location: listbyaccount.php");
|
||||
exit();
|
||||
|
||||
header("Location: listbyaccount.php?noreset=1".($param ? '&'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,22 +319,42 @@ if ($action == 'delmouv') {
|
|||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
$form_question = array();
|
||||
$delyear = GETPOST('delyear');
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
$deljournal = GETPOST('deljournal', 'alpha');
|
||||
|
||||
if (empty($delyear)) {
|
||||
$delyear = dol_print_date(dol_now(), '%Y');
|
||||
}
|
||||
$month_array = array();
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
|
||||
}
|
||||
$year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
$journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
|
||||
|
||||
$form_question['delmonth'] = array(
|
||||
'name' => 'delmonth',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelMonth'),
|
||||
'values' => $month_array,
|
||||
'default' => ''
|
||||
);
|
||||
$form_question['delyear'] = array(
|
||||
'name' => 'delyear',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelYear'),
|
||||
'values' => $year_array,
|
||||
'default' => $delyear
|
||||
'name' => 'delyear',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelYear'),
|
||||
'values' => $year_array,
|
||||
'default' => $delyear
|
||||
);
|
||||
$form_question['deljournal'] = array(
|
||||
'name' => 'deljournal',
|
||||
'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||
'label' => $langs->trans('DelJournal'),
|
||||
'value' => $journal_array,
|
||||
'default' => $deljournal
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 250);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
|
@ -267,53 +377,115 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($l
|
|||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
// Reverse sort order
|
||||
if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc";
|
||||
else $sortorder = "desc";
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200');
|
||||
// Accountancy account
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('AccountAccounting').': ';
|
||||
$moreforfilter .= '<div class="nowrap">';
|
||||
$moreforfilter .= $langs->trans('From').' ';
|
||||
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200');
|
||||
$moreforfilter .= $langs->trans('to').' ';
|
||||
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200');
|
||||
$moreforfilter .= '</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste centpercent">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Code journal
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>';
|
||||
}
|
||||
// Date document
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Movement number
|
||||
if (!empty($arrayfields['t.piece_num']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
|
||||
}
|
||||
// Ref document
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="' . dol_escape_htmltag($search_doc_ref) . '"/></td>';
|
||||
}
|
||||
// Label operation
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>';
|
||||
}
|
||||
// Debit
|
||||
if (!empty($arrayfields['t.debit']['checked'])) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="' . dol_escape_htmltag($search_debit) . '"></td>';
|
||||
}
|
||||
// Credit
|
||||
if (!empty($arrayfields['t.credit']['checked'])) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="' . dol_escape_htmltag($search_credit) . '"></td>';
|
||||
}
|
||||
// Lettering code
|
||||
if (!empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
|
||||
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
print $langs->trans('From').': ';
|
||||
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
print $langs->trans('to').': ';
|
||||
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>';
|
||||
print '<td class="liste_titre right" colspan="2">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
|
||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label");
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
|
@ -323,7 +495,10 @@ $sous_total_debit = 0;
|
|||
$sous_total_credit = 0;
|
||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
|
@ -336,18 +511,39 @@ while ($i < min($num, $limit))
|
|||
|
||||
// Is it a break ?
|
||||
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
|
||||
// Affiche un Sous-Total par compte comptable
|
||||
$colspan = $totalarray['nbfield'] - 3;
|
||||
$colspanend = $totalarray['nbfield'] - 7;
|
||||
// Show a subtotal by accounting account
|
||||
if (isset($displayed_account_number)) {
|
||||
print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "<td> </td>\n";
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accountg($displayed_account_number).':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
|
||||
if ($balance > 0 )
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Show the break account
|
||||
$colspan = 9;
|
||||
print "<tr>";
|
||||
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||
print '<td colspan="'.$totalarray['nbfield'].'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
|
||||
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
||||
print '</td>';
|
||||
|
|
@ -357,72 +553,206 @@ while ($i < min($num, $limit))
|
|||
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
|
||||
$colspan = 0;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td class="right"><a href="./card.php?piece_num='.$line->piece_num.'">'.$line->piece_num.'</a></td>';
|
||||
print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
|
||||
|
||||
// TODO Add a link according to doc_type and fk_doc
|
||||
print '<td class="nowrap">';
|
||||
//if ($line->doc_type == 'supplier_invoice')
|
||||
//if ($line->doc_type == 'customer_invoice')
|
||||
print $line->doc_ref;
|
||||
// Journal code
|
||||
if (!empty($arrayfields['t.code_journal']['checked']))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">'.$journaltoshow.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Document date
|
||||
if (!empty($arrayfields['t.doc_date']['checked']))
|
||||
{
|
||||
print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Piece number
|
||||
if (!empty($arrayfields['t.piece_num']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$object->id = $line->id;
|
||||
$object->piece_num = $line->piece_num;
|
||||
print $object->getNomUrl(1, '', 0, '', 1);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Document ref
|
||||
if (!empty($arrayfields['t.doc_ref']['checked']))
|
||||
{
|
||||
if ($line->doc_type == 'customer_invoice')
|
||||
{
|
||||
$langs->loadLangs(array('bills'));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$objectstatic = new Facture($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'facture';
|
||||
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
} elseif ($line->doc_type == 'supplier_invoice')
|
||||
{
|
||||
$langs->loadLangs(array('bills'));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$objectstatic = new FactureFournisseur($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'invoice_supplier';
|
||||
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
|
||||
} elseif ($line->doc_type == 'expense_report')
|
||||
{
|
||||
$langs->loadLangs(array('trips'));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
$objectstatic = new ExpenseReport($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'expensereport';
|
||||
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
} else {
|
||||
// Other type
|
||||
}
|
||||
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
|
||||
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
|
||||
{
|
||||
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
|
||||
print $documentlink;
|
||||
} else {
|
||||
print $line->doc_ref;
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label operation
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) {
|
||||
// Affiche un lien vers la facture client/fournisseur
|
||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount debit
|
||||
if (!empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
|
||||
$totalarray['val']['totaldebit'] += $line->debit;
|
||||
}
|
||||
|
||||
// Amount credit
|
||||
if (!empty($arrayfields['t.credit']['checked'])) {
|
||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
|
||||
$totalarray['val']['totalcredit'] += $line->credit;
|
||||
}
|
||||
|
||||
// Lettering code
|
||||
if (!empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="center">'.$line->lettering_code.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (empty($line->date_export)) {
|
||||
if ($user->rights->accounting->mouvements->creer) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
|
||||
}
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Affiche un lien vers la facture client/fournisseur
|
||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
|
||||
|
||||
|
||||
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
|
||||
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">'.$journaltoshow.'</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.'">'.img_edit().'</a> ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.'">'.img_delete().'</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show sub-total of last shown account
|
||||
$colspan = $totalarray['nbfield'] - 3;
|
||||
$colspanend = $totalarray['nbfield'] - 8;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td class="nowraponall center">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
|
||||
if ($balance > 0 )
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_debit - $sous_total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
// Show total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="right" colspan="5">'.$langs->trans("Total").':</td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// TODO Replace this with mass delete action
|
||||
if ($user->rights->accounting->mouvements->supprimer_tous) {
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
|
|
|
|||
|
|
@ -209,9 +209,7 @@ class AccountancyCategory // extends CommonObject
|
|||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
|
@ -241,8 +239,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$sql .= " t.active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
|
||||
if ($id) $sql .= " WHERE t.rowid = ".$id;
|
||||
else
|
||||
{
|
||||
else {
|
||||
$sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
|
||||
if ($code) $sql .= " AND t.code = '".$this->db->escape($code)."'";
|
||||
elseif ($label) $sql .= " AND t.label = '".$this->db->escape($label)."'";
|
||||
|
|
@ -270,9 +267,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -335,9 +330,7 @@ class AccountancyCategory // extends CommonObject
|
|||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -375,9 +368,7 @@ class AccountancyCategory // extends CommonObject
|
|||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -709,9 +700,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$listofaccount .= "'".$cptcursor."'";
|
||||
}
|
||||
$sql .= " AND t.numero_compte IN (".$listofaccount.")";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
|
||||
}
|
||||
if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end
|
||||
|
|
@ -833,9 +822,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY t.account_number";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
|
||||
$sql .= " WHERE ".$predefinedgroupwhere;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@
|
|||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.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
|
||||
|
|
@ -52,6 +53,7 @@ class AccountancyExport
|
|||
public static $EXPORT_TYPE_SAGE50_SWISS = 45;
|
||||
public static $EXPORT_TYPE_CHARLEMAGNE = 50;
|
||||
public static $EXPORT_TYPE_QUADRATUS = 60;
|
||||
public static $EXPORT_TYPE_WINFIC = 70;
|
||||
public static $EXPORT_TYPE_OPENCONCERTO = 100;
|
||||
public static $EXPORT_TYPE_LDCOMPTA = 110;
|
||||
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
|
||||
|
|
@ -105,6 +107,7 @@ class AccountancyExport
|
|||
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
|
||||
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
|
||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||
self::$EXPORT_TYPE_WINFIC => $langs->trans('Modelcsv_winfic'),
|
||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||
|
|
@ -136,6 +139,7 @@ class AccountancyExport
|
|||
self::$EXPORT_TYPE_BOB50 => 'bob50',
|
||||
self::$EXPORT_TYPE_CIEL => 'ciel',
|
||||
self::$EXPORT_TYPE_QUADRATUS => 'quadratus',
|
||||
self::$EXPORT_TYPE_WINFIC => 'winfic',
|
||||
self::$EXPORT_TYPE_EBP => 'ebp',
|
||||
self::$EXPORT_TYPE_COGILOG => 'cogilog',
|
||||
self::$EXPORT_TYPE_AGIRIS => 'agiris',
|
||||
|
|
@ -184,6 +188,10 @@ class AccountancyExport
|
|||
'label' => $langs->trans('Modelcsv_quadratus'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||
),
|
||||
self::$EXPORT_TYPE_WINFIC => array(
|
||||
'label' => $langs->trans('Modelcsv_winfic'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||
),
|
||||
self::$EXPORT_TYPE_EBP => array(
|
||||
'label' => $langs->trans('Modelcsv_ebp'),
|
||||
),
|
||||
|
|
@ -246,7 +254,7 @@ class AccountancyExport
|
|||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
global $db; // The tpl file use $db
|
||||
global $db; // The tpl file use $db
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
|
|
@ -269,6 +277,9 @@ class AccountancyExport
|
|||
case self::$EXPORT_TYPE_QUADRATUS :
|
||||
$this->exportQuadratus($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_WINFIC :
|
||||
$this->exportWinfic($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_EBP :
|
||||
$this->exportEbp($TData);
|
||||
break;
|
||||
|
|
@ -351,7 +362,7 @@ class AccountancyExport
|
|||
if ($line->sens == 'D') {
|
||||
print price($line->montant).$separator;
|
||||
print ''.$separator;
|
||||
}elseif ($line->sens == 'C') {
|
||||
} elseif ($line->sens == 'C') {
|
||||
print ''.$separator;
|
||||
print price($line->montant).$separator;
|
||||
}
|
||||
|
|
@ -507,11 +518,12 @@ class AccountancyExport
|
|||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
|
||||
if (!empty($data->date_echeance))
|
||||
if (!empty($data->date_echeance)) {
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy
|
||||
else
|
||||
} else {
|
||||
$Tab['date_echeance'] = '000000';
|
||||
}
|
||||
|
||||
//elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
|
||||
//$Tab['lettrage'] = str_repeat(' ', 5);
|
||||
|
|
@ -548,6 +560,85 @@ class AccountancyExport
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : WinFic - eWinfic - WinSis Compta
|
||||
*
|
||||
*
|
||||
* @param array $TData data
|
||||
* @return void
|
||||
*/
|
||||
public function exportWinfic(&$TData)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$end_line = "\r\n";
|
||||
|
||||
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
foreach ($TData as $data) {
|
||||
$code_compta = $data->numero_compte;
|
||||
if (!empty($data->subledger_account))
|
||||
$code_compta = $data->subledger_account;
|
||||
|
||||
$Tab = array();
|
||||
//$Tab['type_ligne'] = 'M';
|
||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||
|
||||
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
|
||||
//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
|
||||
//$Tab['date_ecriture'] = $date_ecriture;
|
||||
$Tab['date_operation'] = dol_print_date($data->doc_date, '%d%m%Y');
|
||||
|
||||
$Tab['folio'] = ' 1';
|
||||
|
||||
$Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
|
||||
|
||||
if ($data->sens == 'D') {
|
||||
$Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
} else {
|
||||
$Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30);
|
||||
|
||||
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||
|
||||
$Tab['code_piece'] = str_repeat(' ', 5);
|
||||
|
||||
$Tab['code_stat'] = str_repeat(' ', 4);
|
||||
|
||||
if (!empty($data->date_echeance)) {
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y');
|
||||
} else {
|
||||
$Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y');
|
||||
}
|
||||
|
||||
$Tab['monnaie'] = '1';
|
||||
|
||||
$Tab['filler'] = ' ';
|
||||
|
||||
$Tab['ind_compteur'] = ' ';
|
||||
|
||||
$Tab['quantite'] = '0,000000000';
|
||||
|
||||
$Tab['code_pointage'] = str_repeat(' ', 2);
|
||||
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode('|', $Tab);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export format : EBP
|
||||
|
|
@ -807,12 +898,10 @@ class AccountancyExport
|
|||
if ($aIndex - 2 >= 0 && $objectLines[$aIndex - 2]->piece_num == $line->piece_num)
|
||||
{
|
||||
$sammelBuchung = true;
|
||||
}
|
||||
elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num)
|
||||
} elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num)
|
||||
{
|
||||
$sammelBuchung = true;
|
||||
}
|
||||
elseif ($aIndex + 1 < $aSize
|
||||
} elseif ($aIndex + 1 < $aSize
|
||||
&& $objectLines[$aIndex + 1]->piece_num == $line->piece_num
|
||||
&& $aIndex - 1 < $aSize
|
||||
&& $objectLines[$aIndex - 1]->piece_num == $line->piece_num
|
||||
|
|
@ -834,9 +923,7 @@ class AccountancyExport
|
|||
if ($line->sens == 'D')
|
||||
{
|
||||
print 'S'.$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print 'H'.$this->separator;
|
||||
}
|
||||
//Grp
|
||||
|
|
@ -847,14 +934,10 @@ class AccountancyExport
|
|||
if ($line->piece_num == $thisPieceNum)
|
||||
{
|
||||
print length_accounta($thisPieceAccountNr).$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "div".$this->separator;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print length_accounta($line->code_tiers).$this->separator;
|
||||
}
|
||||
//SId
|
||||
|
|
@ -870,9 +953,7 @@ class AccountancyExport
|
|||
if ($sammelBuchung)
|
||||
{
|
||||
print "2".$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "1".$this->separator;
|
||||
}
|
||||
// Code
|
||||
|
|
@ -881,9 +962,7 @@ class AccountancyExport
|
|||
if ($line->montant >= 0)
|
||||
{
|
||||
print $line->montant.$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print ($line->montant * -1).$this->separator;
|
||||
}
|
||||
// Steuer
|
||||
|
|
@ -930,7 +1009,7 @@ class AccountancyExport
|
|||
}
|
||||
|
||||
/**
|
||||
* Export format : LD Compta version 9 & higher
|
||||
* Export format : LD Compta version 9
|
||||
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf
|
||||
*
|
||||
* @param array $objectLines data
|
||||
|
|
@ -1368,7 +1447,9 @@ class AccountancyExport
|
|||
print self::trunc($line->code_journal, 6).$separator; //Journal code
|
||||
|
||||
if (!empty($line->subledger_account)) $account = $line->subledger_account;
|
||||
else $account = $line->numero_compte;
|
||||
else {
|
||||
$account = $line->numero_compte;
|
||||
}
|
||||
print self::trunc($account, 15).$separator; //Account number
|
||||
|
||||
print self::trunc($line->label_compte, 60).$separator; //Account label
|
||||
|
|
|
|||
|
|
@ -553,24 +553,19 @@ class AccountingAccount extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Account deactivated
|
||||
* Deactivate an account (for status active or status reconcilable)
|
||||
*
|
||||
* @param int $id Id
|
||||
* @param int $mode 0=field active, 1=field active_customer_list, 2=field_active_supplier_list
|
||||
* @param int $mode 0=field active, 1=field reconcilable
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function account_desactivate($id, $mode = 0)
|
||||
public function accountDeactivate($id, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = $this->checkUsage();
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$fieldtouse = 'active';
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
$fieldtouse = 'active';
|
||||
if ($mode == 1)
|
||||
{
|
||||
$fieldtouse = 'reconcilable';
|
||||
}
|
||||
|
|
@ -582,7 +577,7 @@ class AccountingAccount extends CommonObject
|
|||
$sql .= "SET ".$fieldtouse." = '0'";
|
||||
$sql .= " WHERE rowid = ".$this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this)."::account_desactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
|
|
@ -614,8 +609,7 @@ class AccountingAccount extends CommonObject
|
|||
if ($mode == 0)
|
||||
{
|
||||
$fieldtouse = 'active';
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
} elseif ($mode == 1)
|
||||
{
|
||||
$fieldtouse = 'reconcilable';
|
||||
}
|
||||
|
|
@ -666,28 +660,23 @@ class AccountingAccount extends CommonObject
|
|||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
} elseif ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
elseif ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
} 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)
|
||||
} 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)
|
||||
} 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)
|
||||
} 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');
|
||||
|
|
|
|||
|
|
@ -109,8 +109,7 @@ class AccountingJournal extends CommonObject
|
|||
$sql .= " WHERE";
|
||||
if ($rowid) {
|
||||
$sql .= " rowid = ".(int) $rowid;
|
||||
}
|
||||
elseif ($journal_code)
|
||||
} elseif ($journal_code)
|
||||
{
|
||||
$sql .= " code = '".$this->db->escape($journal_code)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
|
@ -136,9 +135,7 @@ class AccountingJournal extends CommonObject
|
|||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
|
@ -311,8 +308,7 @@ class AccountingJournal extends CommonObject
|
|||
elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||
elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||
elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
} elseif ($mode == 1)
|
||||
{
|
||||
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||
elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||
|
|
|
|||
|
|
@ -258,9 +258,7 @@ class BookKeeping extends CommonObject
|
|||
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||
{
|
||||
$this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte);
|
||||
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
|
||||
if ($this->subledger_account && $this->subledger_account != $this->numero_compte)
|
||||
|
|
@ -477,8 +475,7 @@ class BookKeeping extends CommonObject
|
|||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart .= $linkclose.'>';
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ if (!$user->rights->accounting->fiscalyear->write)
|
|||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
else {
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ if ($user->socid > 0)
|
|||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
else {
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
|||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
if ($backtopage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@ if (!$user->rights->accounting->bind->write)
|
|||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
else {
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
|
|
@ -202,8 +201,7 @@ if ($action == 'validatehistory') {
|
|||
if ($error)
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
|
|
@ -278,15 +276,13 @@ if ($resql) {
|
|||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
} else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td class="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
} else print $row[1];
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="nowrap right">'.price($row[$i]).'</td>';
|
||||
|
|
@ -353,16 +349,14 @@ if ($resql) {
|
|||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
} else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
} else print $row[1];
|
||||
print '</td>';
|
||||
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
|
@ -342,37 +343,41 @@ if ($result) {
|
|||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$clickpicto = $form->showCheckAddButtons();
|
||||
print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$facturestatic = new Facture($db);
|
||||
$productstatic = new Product($db);
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
|
||||
while ($objp = $db->fetch_object($result)) {
|
||||
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label_compte.'</span>';
|
||||
while ($objp = $db->fetch_object($result))
|
||||
{
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facturestatic->ref = $objp->ref;
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->type = $objp->ftype;
|
||||
|
||||
$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->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;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->type = $objp->line_type;
|
||||
$productstatic->ref = $objp->product_ref;
|
||||
$productstatic->id = $objp->product_id;
|
||||
$productstatic->label = $objp->product_label;
|
||||
$productstatic->type = $objp->line_type;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
|
@ -380,15 +385,15 @@ if ($result) {
|
|||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$facturestatic->getNomUrl(1).'</td>';
|
||||
|
||||
// Date invoice
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id > 0) print $product_static->getNomUrl(1);
|
||||
if ($product_static->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($productstatic->id > 0) print $productstatic->getNomUrl(1);
|
||||
if ($productstatic->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>';
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -415,8 +420,9 @@ if ($result) {
|
|||
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
print '<td>';
|
||||
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print '<td class="center">';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -159,9 +159,7 @@ if ($massaction == 'ventil') {
|
|||
{
|
||||
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
|
||||
$ko++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql .= " SET fk_code_ventilation = ".$monCompte;
|
||||
$sql .= " WHERE rowid = ".$monId;
|
||||
|
|
@ -629,8 +627,7 @@ if ($result) {
|
|||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_sell_l] = $tmpaccount->id;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_sell_l];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,9 +63,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
|||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
if ($backtopage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ if (!$user->rights->accounting->bind->write)
|
|||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
else {
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
|
|
@ -190,15 +189,13 @@ if ($resql) {
|
|||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
} else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td class="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
} else print $row[1];
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="nowrap right">'.price($row[$i]).'</td>';
|
||||
|
|
@ -261,16 +258,14 @@ if ($resql) {
|
|||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
} else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
} else print $row[1];
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="nowrap right">'.price($row[$i]).'</td>';
|
||||
|
|
|
|||
|
|
@ -28,19 +28,22 @@ require '../../main.inc.php';
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
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/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch"));
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch", "hrm"));
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$account_parent = GETPOST('account_parent', 'int');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
// Search Getpost
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
|
|
@ -84,7 +87,8 @@ $formaccounting = new FormAccounting($db);
|
|||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_expensereport = '';
|
||||
$search_login = '';
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
|
|
@ -162,14 +166,21 @@ print '<script type="text/javascript">
|
|||
*/
|
||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||
$sql .= " aa.label, aa.account_number,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
|
||||
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " WHERE erd.fk_code_ventilation > 0";
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_login))) {
|
||||
$sql .= natural_search("u.login", $search_login);
|
||||
}
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= natural_search("er.ref", $search_expensereport);
|
||||
}
|
||||
|
|
@ -218,6 +229,7 @@ if ($result) {
|
|||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport);
|
||||
if ($search_label) $param .= "&search_label=".urlencode($search_label);
|
||||
if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
|
||||
|
|
@ -250,7 +262,8 @@ if ($result) {
|
|||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
|
@ -265,7 +278,6 @@ if ($result) {
|
|||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
|
||||
print '<td class="liste_titre right"></td>';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
|
|
@ -273,7 +285,8 @@ if ($result) {
|
|||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
|
|
@ -283,27 +296,48 @@ if ($result) {
|
|||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$checkpicto = $form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$expensereport_static = new ExpenseReport($db);
|
||||
$expensereportstatic = new ExpenseReport($db);
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$codeCompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>';
|
||||
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
|
||||
$expensereportstatic->ref = $objp->ref;
|
||||
$expensereportstatic->id = $objp->erid;
|
||||
|
||||
$userstatic->id = $objp->rowid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
$userstatic->email = $objp->email;
|
||||
$userstatic->gender = $objp->gender;
|
||||
$userstatic->firstname = $objp->firstname;
|
||||
$userstatic->lastname = $objp->lastname;
|
||||
$userstatic->employee = $objp->employee;
|
||||
$userstatic->photo = $objp->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Login
|
||||
print '<td class="nowraponall">';
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>'.$expensereport_static->getNomUrl(1).'</td>';
|
||||
// Ref Expense report
|
||||
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
|
||||
// Date validation
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
|
|
@ -312,21 +346,26 @@ if ($result) {
|
|||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
|
||||
|
||||
// Fees label
|
||||
print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>';
|
||||
|
||||
// Fees description -- Can be null
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
// Amount without taxes
|
||||
print '<td class="nowrap right">'.price($objp->total_ht).'</td>';
|
||||
|
||||
// Vat rate
|
||||
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
print '<td>'.$codeCompta.'</td>';
|
||||
|
||||
print '<td class="left"><a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
// Accounting account affected
|
||||
print '<td class="center">';
|
||||
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>';
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
|
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch"));
|
||||
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch", "hrm"));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
|
|
@ -50,6 +51,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
|
|||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
|
||||
// Search Getpost
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_lineid = GETPOST('search_lineid', 'alpha');
|
||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
|
|
@ -100,6 +102,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
|||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_login = '';
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
|
|
@ -138,9 +141,7 @@ if ($massaction == 'ventil') {
|
|||
{
|
||||
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
|
||||
$ko++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
$sql .= " SET fk_code_ventilation = ".$monCompte;
|
||||
$sql .= " WHERE rowid = ".$monId;
|
||||
|
|
@ -189,13 +190,18 @@ if (empty($chartaccountcode))
|
|||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_login))) {
|
||||
$sql .= natural_search("u.login", $search_login);
|
||||
}
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= natural_search("er.ref", $search_expensereport);
|
||||
}
|
||||
|
|
@ -245,6 +251,7 @@ if ($result) {
|
|||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||
|
|
@ -289,6 +296,7 @@ if ($result) {
|
|||
|
||||
// We add search filter
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
|
|
@ -312,6 +320,7 @@ if ($result) {
|
|||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
|
|
@ -331,6 +340,7 @@ if ($result) {
|
|||
|
||||
|
||||
$expensereport_static = new ExpenseReport($db);
|
||||
$userstatic = new User($db);
|
||||
$form = new Form($db);
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
|
|
@ -342,7 +352,23 @@ if ($result) {
|
|||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$userstatic->id = $objp->rowid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
$userstatic->email = $objp->email;
|
||||
$userstatic->gender = $objp->gender;
|
||||
$userstatic->firstname = $objp->firstname;
|
||||
$userstatic->lastname = $objp->lastname;
|
||||
$userstatic->employee = $objp->employee;
|
||||
$userstatic->photo = $objp->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Login
|
||||
print '<td class="nowraponall">';
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
|
@ -370,6 +396,7 @@ if ($result) {
|
|||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
// Amount without taxes
|
||||
print '<td class="nowrap right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -240,9 +240,7 @@ if ($conf->accounting->enabled)
|
|||
print $boxlist;
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
|
||||
|
||||
print $langs->trans("Module10Desc")."<br>\n";
|
||||
|
|
|
|||
|
|
@ -276,8 +276,7 @@ if ($result) {
|
|||
// We save tabtype for a future use, to remember what kind of payment it is
|
||||
$tabpay[$obj->rowid]['type'] = $links[$key]['type'];
|
||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||
}
|
||||
elseif (in_array($links[$key]['type'], array('company', 'user')))
|
||||
} elseif (in_array($links[$key]['type'], array('company', 'user')))
|
||||
{
|
||||
if ($tabpay[$obj->rowid]['type'] == 'unknown')
|
||||
{
|
||||
|
|
@ -549,9 +548,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
|
|
@ -575,9 +572,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
if ($tabtype[$key] == 'banktransfert')
|
||||
{
|
||||
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$reflabel .= dol_string_nohtmltag($val['soclib']);
|
||||
}
|
||||
|
||||
|
|
@ -699,9 +694,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
|
|
@ -709,8 +702,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // If thirdparty unknown, output the waiting account
|
||||
} else { // If thirdparty unknown, output the waiting account
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
|
|
@ -747,9 +739,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
|
|
@ -770,9 +760,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//print 'KO for line '.$key.' '.$error.'<br>';
|
||||
$db->rollback();
|
||||
|
||||
|
|
@ -787,13 +775,10 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
} elseif (count($tabpay) == $error)
|
||||
{
|
||||
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
|
|
@ -879,9 +864,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
if ($tabtype[$key] == 'banktransfert')
|
||||
{
|
||||
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$reflabel .= dol_string_nohtmltag($val['soclib']);
|
||||
}
|
||||
|
||||
|
|
@ -979,8 +962,7 @@ if (empty($action) || $action == 'view') {
|
|||
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>');
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
|
||||
|
||||
// Button to write into Ledger
|
||||
|
|
@ -999,8 +981,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
|
|
@ -1072,8 +1053,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accounttoshow;
|
||||
} else print $accounttoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -1104,9 +1084,7 @@ if (empty($action) || $action == 'view') {
|
|||
if ($tabtype[$key] == 'banktransfert')
|
||||
{
|
||||
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$reflabel .= $val['soclib'];
|
||||
}
|
||||
|
||||
|
|
@ -1134,14 +1112,10 @@ if (empty($action) || $action == 'view') {
|
|||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// We will refuse writing
|
||||
$errorstring = 'UnknownAccountForThirdpartyBlocking';
|
||||
if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined';
|
||||
|
|
@ -1152,8 +1126,7 @@ if (empty($action) || $action == 'view') {
|
|||
if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
|
||||
print '<span class="error">'.$langs->trans($errorstring).'</span>';
|
||||
}
|
||||
}
|
||||
else print $accounttoshow;
|
||||
} else print $accounttoshow;
|
||||
print "</td>";
|
||||
|
||||
// Subledger account
|
||||
|
|
@ -1177,13 +1150,10 @@ if (empty($action) || $action == 'view') {
|
|||
} else {
|
||||
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
|
||||
}
|
||||
}
|
||||
else print $accounttoshowsubledger;
|
||||
} else print $accounttoshowsubledger;
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
|
|
@ -1289,57 +1259,49 @@ function getSourceDocRef($val, $typerecord)
|
|||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
|
||||
$ref = $langs->transnoentitiesnoconv("Invoice");
|
||||
}
|
||||
elseif ($typerecord == 'payment_supplier')
|
||||
} elseif ($typerecord == 'payment_supplier')
|
||||
{
|
||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
|
||||
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
|
||||
}
|
||||
elseif ($typerecord == 'payment_expensereport')
|
||||
} elseif ($typerecord == 'payment_expensereport')
|
||||
{
|
||||
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
||||
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
|
||||
}
|
||||
elseif ($typerecord == 'payment_salary')
|
||||
} elseif ($typerecord == 'payment_salary')
|
||||
{
|
||||
$sqlmid = 'SELECT s.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
|
||||
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
|
||||
}
|
||||
elseif ($typerecord == 'sc')
|
||||
} elseif ($typerecord == 'sc')
|
||||
{
|
||||
$sqlmid = 'SELECT sc.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
|
||||
$sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
|
||||
$ref = $langs->transnoentitiesnoconv("SocialContribution");
|
||||
}
|
||||
elseif ($typerecord == 'payment_vat')
|
||||
} elseif ($typerecord == 'payment_vat')
|
||||
{
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
|
||||
$sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
|
||||
$ref = $langs->transnoentitiesnoconv("PaymentVat");
|
||||
}
|
||||
elseif ($typerecord == 'payment_donation')
|
||||
} elseif ($typerecord == 'payment_donation')
|
||||
{
|
||||
$sqlmid = 'SELECT payd.fk_donation as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
|
||||
$sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
|
||||
$ref = $langs->transnoentitiesnoconv("Donation");
|
||||
}
|
||||
elseif ($typerecord == 'payment_loan')
|
||||
} elseif ($typerecord == 'payment_loan')
|
||||
{
|
||||
$sqlmid = 'SELECT l.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
|
||||
$sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
|
||||
$ref = $langs->transnoentitiesnoconv("LoanPayment");
|
||||
}
|
||||
elseif ($typerecord == 'payment_various')
|
||||
} elseif ($typerecord == 'payment_various')
|
||||
{
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
|
|
@ -1362,8 +1324,7 @@ function getSourceDocRef($val, $typerecord)
|
|||
{
|
||||
$ref .= ' '.$objmid->ref;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
}
|
||||
|
||||
$ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
|
||||
|
|
|
|||
|
|
@ -231,9 +231,7 @@ if ($action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
|
|
@ -281,9 +279,7 @@ if ($action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
|
|
@ -341,9 +337,7 @@ if ($action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
|
|
@ -365,9 +359,7 @@ if ($action == 'writebookkeeping') {
|
|||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($error >= 10)
|
||||
|
|
@ -382,13 +374,10 @@ if ($action == 'writebookkeeping') {
|
|||
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
} elseif (count($tabpay) == $error)
|
||||
{
|
||||
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
|
|
@ -511,8 +500,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
|
|
@ -582,8 +570,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -612,8 +599,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -621,8 +607,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("UserAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? -price(-$mt) : '')."</td>";
|
||||
|
|
@ -649,8 +634,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
|
|||
|
|
@ -152,8 +152,9 @@ if ($result) {
|
|||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
else {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
|
||||
|
|
@ -226,8 +227,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice
|
|||
{
|
||||
$errorforinvoice[$key] = 'somelinesarenotbound';
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
}
|
||||
//var_dump($errorforinvoice);exit;
|
||||
|
||||
|
|
@ -331,9 +331,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -383,9 +381,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -446,9 +442,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -499,9 +493,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -524,9 +516,7 @@ if ($action == 'writebookkeeping') {
|
|||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($error >= 10)
|
||||
|
|
@ -541,13 +531,10 @@ if ($action == 'writebookkeeping') {
|
|||
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
} elseif (count($tabpay) == $error)
|
||||
{
|
||||
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
|
|
@ -743,8 +730,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
|
|
@ -871,8 +857,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -880,8 +865,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount")."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
|
|
@ -904,8 +888,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -937,8 +920,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -968,8 +950,7 @@ if (empty($action) || $action == 'view') {
|
|||
if ($accountoshow == '' || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
|
|||
|
|
@ -158,8 +158,9 @@ if ($result) {
|
|||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
else {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
|
||||
|
|
@ -240,8 +241,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice
|
|||
{
|
||||
$errorforinvoice[$key] = 'somelinesarenotbound';
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
}
|
||||
//var_dump($errorforinvoice);exit;
|
||||
|
||||
|
|
@ -342,9 +342,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -394,9 +392,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -456,9 +452,7 @@ if ($action == 'writebookkeeping') {
|
|||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
|
|
@ -482,9 +476,7 @@ if ($action == 'writebookkeeping') {
|
|||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($error >= 10)
|
||||
|
|
@ -499,13 +491,9 @@ if ($action == 'writebookkeeping') {
|
|||
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
{
|
||||
} elseif (count($tabpay) == $error) {
|
||||
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
|
|
@ -659,8 +647,9 @@ if (empty($action) || $action == 'view') {
|
|||
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
else
|
||||
else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
|
|
@ -680,8 +669,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
|
|
@ -807,8 +795,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -816,8 +803,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount")."</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
|
|
@ -841,8 +827,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
@ -875,8 +860,7 @@ if (empty($action) || $action == 'view') {
|
|||
if (($accountoshow == "") || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
} else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
|
|
|||
|
|
@ -63,9 +63,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
|||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
if ($backtopage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ if (!$user->rights->accounting->bind->write)
|
|||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
else {
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
|
|
@ -192,8 +191,7 @@ if ($action == 'validatehistory') {
|
|||
if ($error)
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
|
|
@ -262,15 +260,13 @@ if ($resql) {
|
|||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
} else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td class="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
} else print $row[1];
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="nowrap right">'.price($row[$i]).'</td>';
|
||||
|
|
@ -332,15 +328,13 @@ if ($resql) {
|
|||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("Unknown");
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
} else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
print '<td class="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||
}
|
||||
else print $row[1];
|
||||
} else print $row[1];
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 12; $i++) {
|
||||
print '<td class="nowrap right">'.price($row[$i]).'</td>';
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
|
@ -346,38 +347,42 @@ if ($result) {
|
|||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$checkpicto = $form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$facturefournisseur_static = new FactureFournisseur($db);
|
||||
$product_static = new ProductFournisseur($db);
|
||||
$productstatic = new ProductFournisseur($db);
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
while ($i < min($num_lines, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>';
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
|
||||
$facturefournisseur_static->ref = $objp->ref;
|
||||
$facturefournisseur_static->id = $objp->facid;
|
||||
|
||||
$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->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;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->type = $objp->line_type;
|
||||
$productstatic->ref = $objp->product_ref;
|
||||
$productstatic->id = $objp->product_id;
|
||||
$productstatic->label = $objp->product_label;
|
||||
$productstatic->type = $objp->line_type;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
|
@ -425,8 +430,9 @@ if ($result) {
|
|||
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
print '<td>';
|
||||
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print '<td class="center">';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda" 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>';
|
||||
|
|
|
|||
|
|
@ -163,9 +163,7 @@ if ($massaction == 'ventil') {
|
|||
{
|
||||
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
|
||||
$ko++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sql .= " SET fk_code_ventilation = ".$monCompte;
|
||||
$sql .= " WHERE rowid = ".$monId;
|
||||
|
|
@ -320,7 +318,7 @@ if ($result) {
|
|||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_societe) $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_societe) $param .= '&search_societe='.urlencode($search_societe);
|
||||
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||
|
|
@ -609,8 +607,7 @@ if ($result) {
|
|||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
|
|||
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
|
||||
|
||||
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ $action = GETPOST('action', 'alpha');
|
|||
*/
|
||||
|
||||
//
|
||||
if ($action == 'updateall')
|
||||
{
|
||||
if ($action == 'updateall') {
|
||||
$db->begin();
|
||||
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
|
||||
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
|
||||
|
|
@ -58,36 +57,29 @@ if ($action == 'updateall')
|
|||
$res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
if ($conf->facture->enabled) {
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
||||
{
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
$res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
|
||||
{
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update or add a constant
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
if ($action == 'update' || $action == 'add') {
|
||||
$constname = GETPOST('constname', 'alpha');
|
||||
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||
|
||||
if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = '';
|
||||
if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||
{
|
||||
if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') { // Invert choice
|
||||
if ($constvalue) $constvalue = 0;
|
||||
else $constvalue = 1;
|
||||
}
|
||||
|
|
@ -98,32 +90,25 @@ if ($action == 'update' || $action == 'add')
|
|||
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Action to enable of a submodule of the adherent module
|
||||
if ($action == 'set')
|
||||
{
|
||||
if ($action == 'set') {
|
||||
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to disable a submodule of the adherent module
|
||||
if ($action == 'unset')
|
||||
{
|
||||
if ($action == 'unset') {
|
||||
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
|
@ -183,33 +168,27 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
|
|||
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
|
||||
print '<td>';
|
||||
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
|
||||
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice')
|
||||
{
|
||||
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
|
||||
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
if ($conf->facture->enabled) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td>';
|
||||
print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td class="right">';
|
||||
print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name"));
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
||||
{
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
|
||||
print '<td>';
|
||||
$form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0);
|
||||
|
|
@ -234,12 +213,12 @@ print '<br>';
|
|||
*/
|
||||
$constantes = array(
|
||||
'ADHERENT_CARD_TYPE',
|
||||
// 'ADHERENT_CARD_BACKGROUND',
|
||||
//'ADHERENT_CARD_BACKGROUND',
|
||||
'ADHERENT_CARD_HEADER_TEXT',
|
||||
'ADHERENT_CARD_TEXT',
|
||||
'ADHERENT_CARD_TEXT_RIGHT',
|
||||
'ADHERENT_CARD_FOOTER_TEXT'
|
||||
);
|
||||
);
|
||||
|
||||
print load_fiche_titre($langs->trans("MembersCards"), '', '');
|
||||
|
||||
|
|
|
|||
|
|
@ -65,26 +65,21 @@ $constantes = array(
|
|||
*/
|
||||
|
||||
//
|
||||
if ($action == 'updateall')
|
||||
{
|
||||
if ($action == 'updateall') {
|
||||
$db->begin();
|
||||
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
|
||||
$res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
|
||||
{
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update or add a constant
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
if ($action == 'update' || $action == 'add') {
|
||||
$constlineid = GETPOST('rowid', 'int');
|
||||
$constname = GETPOST('constname', 'alpha');
|
||||
|
||||
|
|
@ -98,32 +93,25 @@ if ($action == 'update' || $action == 'add')
|
|||
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Action to enable a submodule of the adherent module
|
||||
if ($action == 'set')
|
||||
{
|
||||
if ($action == 'set') {
|
||||
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to disable a submodule of the adherent module
|
||||
if ($action == 'unset')
|
||||
{
|
||||
if ($action == 'unset') {
|
||||
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ dol_fiche_end();
|
|||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
|
||||
print "</div>";
|
||||
|
|
@ -92,8 +91,7 @@ if ($action != 'create' && $action != 'edit')
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print '<div name="topofform"></div><br>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
|
|
@ -105,8 +103,7 @@ if ($action == 'create')
|
|||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print '<div name="topofform"></div><br>';
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ dol_fiche_end();
|
|||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute").'</a></div>';
|
||||
print "</div>";
|
||||
|
|
@ -95,8 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
|
|
@ -108,8 +106,7 @@ if ($action == 'create')
|
|||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
|
|
|
|||
|
|
@ -42,14 +42,12 @@ if (!$user->admin) accessforbidden();
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setMEMBER_ENABLE_PUBLIC')
|
||||
{
|
||||
if ($action == 'setMEMBER_ENABLE_PUBLIC') {
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
if ($action == 'update') {
|
||||
$public = GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||
$amount = GETPOST('MEMBER_NEWFORM_AMOUNT');
|
||||
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
|
||||
|
|
@ -61,16 +59,15 @@ if ($action == 'update')
|
|||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
|
||||
if ($forcetype < 0) $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
|
||||
else $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
|
||||
else {
|
||||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
|
@ -99,8 +96,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
|||
|
||||
dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
function initemail()
|
||||
|
|
@ -139,15 +135,12 @@ print '<span class="opacitymedium">'.$langs->trans("BlankSubscriptionFormDesc").
|
|||
|
||||
|
||||
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
|
|
@ -159,8 +152,7 @@ print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC
|
|||
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
|
|
@ -221,8 +213,7 @@ dol_fiche_end();
|
|||
print '</form>';
|
||||
|
||||
|
||||
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||
|
|
|
|||
|
|
@ -49,13 +49,10 @@ $pagenext = $page + 1;
|
|||
if (!$sortfield) $sortfield = 'a.datep,a.id';
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
|
@ -65,8 +62,7 @@ $result = restrictedArea($user, 'adherent', $id);
|
|||
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
|
|
@ -82,19 +78,16 @@ $parameters = array('id'=>$id, 'objcanvas'=>$objcanvas);
|
|||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage))
|
||||
{
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$actioncode = '';
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
}
|
||||
|
|
@ -112,8 +105,7 @@ $form = new Form($db);
|
|||
/*
|
||||
* Customer and/or supplier category sheet
|
||||
*/
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
|
|
@ -149,13 +141,11 @@ if ($object->id > 0)
|
|||
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($conf->agenda->enabled))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
|
||||
}
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
print '<br>';
|
||||
|
||||
$param = '&id='.$id;
|
||||
|
|
|
|||
|
|
@ -91,18 +91,15 @@ abstract class ActionsAdherentCardCommon
|
|||
|
||||
if ($action == 'add' || $action == 'update') $this->assign_post();
|
||||
|
||||
foreach ($this->object as $key => $value)
|
||||
{
|
||||
foreach ($this->object as $key => $value) {
|
||||
$this->tpl[$key] = $value;
|
||||
}
|
||||
|
||||
$this->tpl['error'] = $this->error;
|
||||
$this->tpl['errors'] = $this->errors;
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
if ($action == 'create' || $action == 'edit') {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
|
|
@ -114,13 +111,10 @@ abstract class ActionsAdherentCardCommon
|
|||
</script>'."\n";
|
||||
}
|
||||
|
||||
if (is_object($objsoc) && $objsoc->id > 0)
|
||||
{
|
||||
if (is_object($objsoc) && $objsoc->id > 0) {
|
||||
$this->tpl['company'] = $objsoc->getNomUrl(1);
|
||||
$this->tpl['company_id'] = $objsoc->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1);
|
||||
}
|
||||
|
||||
|
|
@ -128,8 +122,7 @@ abstract class ActionsAdherentCardCommon
|
|||
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
|
||||
|
||||
// Predefined with third party
|
||||
if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE'))
|
||||
{
|
||||
if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) {
|
||||
if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
|
||||
if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;
|
||||
if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town;
|
||||
|
|
@ -161,38 +154,30 @@ abstract class ActionsAdherentCardCommon
|
|||
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
|
||||
}
|
||||
|
||||
if ($action == 'view' || $action == 'edit' || $action == 'delete')
|
||||
{
|
||||
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
|
||||
// Emailing
|
||||
if (!empty($conf->mailing->enabled))
|
||||
{
|
||||
if (!empty($conf->mailing->enabled)) {
|
||||
$langs->load("mails");
|
||||
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
|
||||
}
|
||||
|
||||
// Dolibarr user
|
||||
if ($this->object->user_id)
|
||||
{
|
||||
if ($this->object->user_id) {
|
||||
$dolibarr_user = new User($this->db);
|
||||
$result = $dolibarr_user->fetch($this->object->user_id);
|
||||
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
|
||||
}
|
||||
else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
|
||||
} else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
|
||||
}
|
||||
|
||||
if ($action == 'view' || $action == 'delete')
|
||||
{
|
||||
if ($action == 'view' || $action == 'delete') {
|
||||
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
|
||||
|
||||
if ($this->object->socid > 0)
|
||||
{
|
||||
if ($this->object->socid > 0) {
|
||||
$objsoc = new Societe($this->db);
|
||||
|
||||
$objsoc->fetch($this->object->socid);
|
||||
$this->tpl['company'] = $objsoc->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->tpl['company'] = $langs->trans("AdherentNotLinkedToThirdParty");
|
||||
}
|
||||
|
||||
|
|
@ -214,8 +199,7 @@ abstract class ActionsAdherentCardCommon
|
|||
$this->tpl['note'] = nl2br($this->object->note);
|
||||
}
|
||||
|
||||
if ($action == 'create_user')
|
||||
{
|
||||
if ($action == 'create_user') {
|
||||
// Full firstname and lastname separated with a dot : firstname.lastname
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
|
|
@ -263,19 +247,15 @@ abstract class ActionsAdherentCardCommon
|
|||
$this->object->canvas = $_POST["canvas"];
|
||||
|
||||
// We set country_id, and country_code label of the chosen country
|
||||
if ($this->object->country_id)
|
||||
{
|
||||
if ($this->object->country_id) {
|
||||
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->object->country_code = $obj->code;
|
||||
$this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
|||
$this->tpl['error'] = $this->error;
|
||||
$this->tpl['errors'] = $this->errors;
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
if ($action == 'view') {
|
||||
// Card header
|
||||
$head = member_prepare_head($this->object);
|
||||
$title = $this->getTitle($action);
|
||||
|
|
@ -105,18 +104,14 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
|||
$this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
|
||||
|
||||
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Confirm delete contact
|
||||
if ($action == 'delete' && $user->rights->adherent->supprimer)
|
||||
{
|
||||
if ($action == 'delete' && $user->rights->adherent->supprimer) {
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -55,13 +55,11 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($mode == 'cardlogin' && empty($foruserlogin))
|
||||
{
|
||||
if ($mode == 'cardlogin' && empty($foruserlogin)) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
|
||||
}
|
||||
|
||||
if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
||||
{
|
||||
if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
$arrayofmembers = array();
|
||||
|
||||
// request taking into account member with up to date subscriptions
|
||||
|
|
@ -83,12 +81,10 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
|||
|
||||
dol_syslog("Search members", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
if ($objp->country == '-') $objp->country = '';
|
||||
|
|
@ -98,14 +94,11 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
|||
$adherentstatic->firstname = $objp->firstname;
|
||||
|
||||
// Format extrafield so they can be parsed in function complete_substitutions_array
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
||||
{
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$adherentstatic->array_options = array();
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$tmpkey = 'options_'.$key;
|
||||
if (!empty($objp->$tmpkey))
|
||||
{
|
||||
if (!empty($objp->$tmpkey)) {
|
||||
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
|
||||
}
|
||||
//if (!empty($objp->$key))
|
||||
|
|
@ -139,20 +132,17 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
|||
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||
|
||||
// For business cards
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin')
|
||||
{
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
|
||||
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
|
||||
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
|
||||
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
|
||||
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
|
||||
|
||||
if (is_numeric($foruserid) || $foruserlogin)
|
||||
{
|
||||
if (is_numeric($foruserid) || $foruserlogin) {
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
|
||||
if ($nb <= 0) $nb = 1; // Protection to avoid empty page
|
||||
|
||||
for ($j = 0; $j < $nb; $j++)
|
||||
{
|
||||
for ($j = 0; $j < $nb; $j++) {
|
||||
$arrayofmembers[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
|
|
@ -162,11 +152,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
|||
'photo'=>$objp->photo
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$arrayofmembers[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
'textright'=>$textright,
|
||||
|
|
@ -177,8 +165,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
|||
}
|
||||
|
||||
// For labels
|
||||
if ($mode == 'label')
|
||||
{
|
||||
if ($mode == 'label') {
|
||||
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
|
||||
$textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
|
||||
$textheader = '';
|
||||
|
|
@ -197,43 +184,32 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
|
|||
}
|
||||
|
||||
// Build and output PDF
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin')
|
||||
{
|
||||
if (!count($arrayofmembers))
|
||||
{
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
|
||||
if (!count($arrayofmembers)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
if (empty($model) || $model == '-1')
|
||||
{
|
||||
if (empty($model) || $model == '-1') {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
|
||||
}
|
||||
if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
|
||||
}
|
||||
elseif ($mode == 'label')
|
||||
{
|
||||
if (!count($arrayofmembers))
|
||||
{
|
||||
} elseif ($mode == 'label') {
|
||||
if (!count($arrayofmembers)) {
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
if (empty($modellabel) || $modellabel == '-1')
|
||||
{
|
||||
if (empty($modellabel) || $modellabel == '-1') {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
|
||||
}
|
||||
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
dol_print_error('', $result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (!$mesg)
|
||||
{
|
||||
if (!$mesg) {
|
||||
$db->close();
|
||||
exit;
|
||||
}
|
||||
|
|
@ -266,8 +242,7 @@ print '<input type="hidden" name="action" value="builddoc">';
|
|||
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
|
||||
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
$arrayoflabels = array();
|
||||
foreach (array_keys($_Avery_Labels) as $codecards)
|
||||
{
|
||||
foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
|
|
@ -285,8 +260,7 @@ print '<input type="hidden" name="action" value="builddoc">';
|
|||
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
|
||||
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
$arrayoflabels = array();
|
||||
foreach (array_keys($_Avery_Labels) as $codecards)
|
||||
{
|
||||
foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
|
|
@ -305,8 +279,7 @@ print '<input type="hidden" name="action" value="builddoc">';
|
|||
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
|
||||
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
|
||||
$arrayoflabels = array();
|
||||
foreach (array_keys($_Avery_Labels) as $codecards)
|
||||
{
|
||||
foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
|
|
|
|||
|
|
@ -660,8 +660,7 @@ class Adherent extends CommonObject
|
|||
$action = 'update';
|
||||
|
||||
// Actions on extra fields
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -704,8 +703,7 @@ class Adherent extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error && $nbrowsaffected) // If something has change in main data
|
||||
{
|
||||
if (!$error && $nbrowsaffected) { // If something has change in main data
|
||||
// Update information on linked user if it is an update
|
||||
if (!$error && $this->user_id > 0 && !$nosyncuser) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
|
@ -1282,10 +1280,11 @@ class Adherent extends CommonObject
|
|||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_code;
|
||||
if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code)
|
||||
if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) {
|
||||
$this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code);
|
||||
else
|
||||
} else {
|
||||
$this->country = $obj->country;
|
||||
}
|
||||
|
||||
$this->phone = $obj->phone;
|
||||
$this->phone_perso = $obj->phone_perso;
|
||||
|
|
@ -1554,8 +1553,7 @@ class Adherent extends CommonObject
|
|||
$customer = new Societe($this->db);
|
||||
|
||||
if (!$error) {
|
||||
if (!($this->fk_soc > 0)) // If not yet linked to a company
|
||||
{
|
||||
if (!($this->fk_soc > 0)) { // If not yet linked to a company
|
||||
if ($autocreatethirdparty) {
|
||||
// Create a linked thirdparty to member
|
||||
$companyalias = '';
|
||||
|
|
@ -2037,12 +2035,13 @@ class Adherent extends CommonObject
|
|||
if ($withpictoimg > -2 && $withpictoimg != 2) {
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<span class="nopadding valignmiddle'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').
|
||||
($morecss ? ' usertext'.$morecss : '').'">';
|
||||
if ($mode == 'login')
|
||||
if ($mode == 'login') {
|
||||
$result .= dol_trunc($this->login, $maxlen);
|
||||
elseif ($mode == 'ref')
|
||||
} elseif ($mode == 'ref') {
|
||||
$result .= $this->id;
|
||||
else
|
||||
} else {
|
||||
$result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen);
|
||||
}
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '</span>';
|
||||
}
|
||||
if ($withpictoimg) $result .= '</div>';
|
||||
|
|
@ -2418,8 +2417,7 @@ class Adherent extends CommonObject
|
|||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $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)
|
||||
} // Set LDAP password if possible
|
||||
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||
{
|
||||
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
|
||||
// Just for the default MD5 !
|
||||
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
|
||||
|
|
@ -2618,8 +2616,7 @@ class Adherent extends CommonObject
|
|||
|
||||
$blockingerrormsg = '';
|
||||
|
||||
if (empty($conf->adherent->enabled)) // Should not happen. If module disabled, cron job should not be visible.
|
||||
{
|
||||
if (empty($conf->adherent->enabled)) { // Should not happen. If module disabled, cron job should not be visible.
|
||||
$langs->load("agenda");
|
||||
$this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
|
||||
return 0;
|
||||
|
|
@ -2638,8 +2635,7 @@ class Adherent extends CommonObject
|
|||
$listofmembersko = array();
|
||||
|
||||
$arraydaysbeforeend = explode(';', $daysbeforeendlist);
|
||||
foreach ($arraydaysbeforeend as $daysbeforeend) // Loop on each delay
|
||||
{
|
||||
foreach ($arraydaysbeforeend as $daysbeforeend) { // Loop on each delay
|
||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||
|
||||
if (!is_numeric($daysbeforeend)) {
|
||||
|
|
@ -2803,10 +2799,11 @@ class Adherent extends CommonObject
|
|||
$listofids .= ', ...';
|
||||
break;
|
||||
}
|
||||
if (empty($listofids))
|
||||
if (empty($listofids)) {
|
||||
$listofids .= ' [';
|
||||
else
|
||||
} else {
|
||||
$listofids .= ', ';
|
||||
}
|
||||
$listofids .= $idmember;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -2823,10 +2820,11 @@ class Adherent extends CommonObject
|
|||
$listofids .= ', ...';
|
||||
break;
|
||||
}
|
||||
if (empty($listofids))
|
||||
if (empty($listofids)) {
|
||||
$listofids .= ' [';
|
||||
else
|
||||
} else {
|
||||
$listofids .= ', ';
|
||||
}
|
||||
$listofids .= $idmember;
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,12 +132,10 @@ class AdherentType extends CommonObject
|
|||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
while ($obj = $this->db->fetch_object($result))
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
|
||||
if ($obj->lang == $current_lang) // si on a les traduct. dans la langue courante on les charge en infos principales.
|
||||
{
|
||||
$this->label = $obj->label;
|
||||
if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales.
|
||||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->email = $obj->email;
|
||||
}
|
||||
|
|
@ -146,9 +144,7 @@ class AdherentType extends CommonObject
|
|||
$this->multilangs["$obj->lang"]["email"] = $obj->email;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = "Error: ".$this->db->lasterror()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -167,8 +163,7 @@ class AdherentType extends CommonObject
|
|||
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
foreach ($langs_available as $key => $value)
|
||||
{
|
||||
foreach ($langs_available as $key => $value) {
|
||||
if ($key == $current_lang) {
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
|
|
@ -177,16 +172,13 @@ class AdherentType extends CommonObject
|
|||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($this->db->num_rows($result)) // if there is already a description line for this language
|
||||
{
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
if ($this->db->num_rows($result)) { // if there is already a description line for this language
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql2 .= " SET ";
|
||||
$sql2 .= " label='".$this->db->escape($this->label)."',";
|
||||
$sql2 .= " description='".$this->db->escape($this->description)."'";
|
||||
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
|
||||
$sql2 .= ")";
|
||||
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',";
|
||||
|
|
@ -198,8 +190,7 @@ class AdherentType extends CommonObject
|
|||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
elseif (isset($this->multilangs[$key])) {
|
||||
} elseif (isset($this->multilangs[$key])) {
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql .= " WHERE fk_type=".$this->id;
|
||||
|
|
@ -207,16 +198,13 @@ class AdherentType extends CommonObject
|
|||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($this->db->num_rows($result)) // if there is already a description line for this language
|
||||
{
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
if ($this->db->num_rows($result)) { // if there is already a description line for this language
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
|
||||
$sql2 .= " SET ";
|
||||
$sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
|
||||
$sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
|
||||
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
|
||||
$sql2 .= ")";
|
||||
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',";
|
||||
|
|
@ -231,9 +219,7 @@ class AdherentType extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// language is not current language and we didn't provide a multilang description for this language
|
||||
}
|
||||
}
|
||||
|
|
@ -274,9 +260,7 @@ class AdherentType extends CommonObject
|
|||
}
|
||||
// End call triggers
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
|
|
@ -313,39 +297,31 @@ class AdherentType extends CommonObject
|
|||
|
||||
dol_syslog("Adherent_type::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
|
||||
|
||||
$result = $this->update($user, 1);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (!$notrigger)
|
||||
{
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_TYPE_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
|
|
@ -382,8 +358,7 @@ class AdherentType extends CommonObject
|
|||
$sql .= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$this->description = $this->db->escape($this->note);
|
||||
|
||||
// Multilangs
|
||||
|
|
@ -397,37 +372,29 @@ class AdherentType extends CommonObject
|
|||
$action = 'update';
|
||||
|
||||
// Actions on extra fields
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_TYPE_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
return -$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
|
|
@ -449,8 +416,7 @@ class AdherentType extends CommonObject
|
|||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_TYPE_DELETE', $user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -2; }
|
||||
|
|
@ -458,9 +424,7 @@ class AdherentType extends CommonObject
|
|||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
|
|
@ -484,10 +448,8 @@ class AdherentType extends CommonObject
|
|||
dol_syslog("Adherent_type::fetch", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
|
@ -511,9 +473,7 @@ class AdherentType extends CommonObject
|
|||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -537,24 +497,19 @@ class AdherentType extends CommonObject
|
|||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$nump = $this->db->num_rows($resql);
|
||||
|
||||
if ($nump)
|
||||
{
|
||||
if ($nump) {
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
while ($i < $nump) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$adherenttypes[$obj->rowid] = $langs->trans($obj->label);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $this->db->error();
|
||||
}
|
||||
return $adherenttypes;
|
||||
|
|
@ -583,14 +538,10 @@ class AdherentType extends CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if (!array_key_exists($obj->rowid, $ret))
|
||||
{
|
||||
if ($mode < 2)
|
||||
{
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!array_key_exists($obj->rowid, $ret)) {
|
||||
if ($mode < 2) {
|
||||
$memberstatic = new Adherent($this->db);
|
||||
if ($mode == 1) {
|
||||
$memberstatic->fetch($obj->rowid, '', '', '', false, false);
|
||||
|
|
@ -598,8 +549,7 @@ class AdherentType extends CommonObject
|
|||
$memberstatic->fetch($obj->rowid);
|
||||
}
|
||||
$ret[$obj->rowid] = $memberstatic;
|
||||
}
|
||||
else $ret[$obj->rowid] = $obj->rowid;
|
||||
} else $ret[$obj->rowid] = $obj->rowid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -608,9 +558,7 @@ class AdherentType extends CommonObject
|
|||
$this->members = $ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -625,9 +573,7 @@ class AdherentType extends CommonObject
|
|||
public function getmorphylib($morphy = '')
|
||||
{
|
||||
global $langs;
|
||||
if ($morphy == 'phy') { return $langs->trans("Physical"); }
|
||||
elseif ($morphy == 'mor') { return $langs->trans("Moral"); }
|
||||
else return $langs->trans("MorPhy");
|
||||
if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } else return $langs->trans("MorPhy");
|
||||
//return $morphy;
|
||||
}
|
||||
|
||||
|
|
@ -685,8 +631,7 @@ class AdherentType extends CommonObject
|
|||
$statusType = 'status4';
|
||||
if ($status == 0) $statusType = 'status5';
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
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");
|
||||
|
|
@ -739,11 +684,9 @@ class AdherentType extends CommonObject
|
|||
// Champs
|
||||
if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
|
||||
if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) {
|
||||
$valueofldapfield = array();
|
||||
foreach ($this->members as $key=>$val) // This is array of users for group into dolibarr database.
|
||||
{
|
||||
foreach ($this->members as $key=>$val) { // This is array of users for group into dolibarr database.
|
||||
$member = new Adherent($this->db);
|
||||
$member->fetch($val->id, '', '', '', false, false);
|
||||
$info2 = $member->_load_ldap_info();
|
||||
|
|
@ -793,8 +736,7 @@ class AdherentType extends CommonObject
|
|||
{
|
||||
global $conf;
|
||||
|
||||
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid)))
|
||||
{
|
||||
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) {
|
||||
return $this->mail_valid;
|
||||
}
|
||||
|
||||
|
|
@ -811,8 +753,7 @@ class AdherentType extends CommonObject
|
|||
global $conf;
|
||||
|
||||
// mail_subscription not defined so never used
|
||||
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
|
||||
{
|
||||
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) { // Property not yet defined
|
||||
return $this->mail_subscription;
|
||||
}
|
||||
|
||||
|
|
@ -829,9 +770,8 @@ class AdherentType extends CommonObject
|
|||
global $conf;
|
||||
|
||||
// NOTE mail_resiliate not defined so never used
|
||||
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_resiliate;
|
||||
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
|
||||
return $this->mail_resiliate;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ class AdherentStats extends Stats
|
|||
$this->where .= " m.statut != 0";
|
||||
$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 = " .$user->id;
|
||||
if ($this->memberid)
|
||||
{
|
||||
if ($this->memberid) {
|
||||
$this->where .= " AND m.rowid = ".$this->memberid;
|
||||
}
|
||||
//if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
|
||||
|
|
|
|||
|
|
@ -109,8 +109,7 @@ class Members extends DolibarrApi
|
|||
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
|
||||
}
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
|
||||
if (!empty($typeid))
|
||||
{
|
||||
if (!empty($typeid)) {
|
||||
$sql .= ' AND t.fk_adherent_type='.$typeid;
|
||||
}
|
||||
// Select members of given category
|
||||
|
|
@ -119,10 +118,8 @@ class Members extends DolibarrApi
|
|||
$sql .= " AND c.fk_member = t.rowid ";
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
|
|
@ -131,8 +128,7 @@ class Members extends DolibarrApi
|
|||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
|
@ -141,13 +137,11 @@ class Members extends DolibarrApi
|
|||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
{
|
||||
while ($i < $min) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$member = new Adherent($this->db);
|
||||
if ($member->fetch($obj->rowid)) {
|
||||
|
|
@ -155,8 +149,7 @@ class Members extends DolibarrApi
|
|||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror());
|
||||
}
|
||||
if (!count($obj_ret)) {
|
||||
|
|
@ -236,13 +229,10 @@ class Members extends DolibarrApi
|
|||
|
||||
// If there is no error, update() returns the number of affected rows
|
||||
// so if the update is a no op, the return value is zero.
|
||||
if ($member->update(DolibarrApiAccess::$user) >= 0)
|
||||
{
|
||||
if ($member->update(DolibarrApiAccess::$user) >= 0) {
|
||||
return $this->get($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, $member->error);
|
||||
} else {
|
||||
throw new RestException(500, $member->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,10 +101,8 @@ class MembersTypes extends DolibarrApi
|
|||
$sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
|
|
@ -113,8 +111,7 @@ class MembersTypes extends DolibarrApi
|
|||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
|
@ -123,13 +120,11 @@ class MembersTypes extends DolibarrApi
|
|||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
{
|
||||
while ($i < $min) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$membertype = new AdherentType($this->db);
|
||||
if ($membertype->fetch($obj->rowid)) {
|
||||
|
|
@ -137,8 +132,7 @@ class MembersTypes extends DolibarrApi
|
|||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieve member type list : '.$db->lasterror());
|
||||
}
|
||||
if (!count($obj_ret)) {
|
||||
|
|
@ -204,13 +198,10 @@ class MembersTypes extends DolibarrApi
|
|||
|
||||
// If there is no error, update() returns the number of affected rows
|
||||
// so if the update is a no op, the return value is zero.
|
||||
if ($membertype->update(DolibarrApiAccess::$user) >= 0)
|
||||
{
|
||||
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
|
||||
return $this->get($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, $membertype->error);
|
||||
} else {
|
||||
throw new RestException(500, $membertype->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,10 +99,8 @@ class Subscriptions extends DolibarrApi
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."subscription as t";
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
|
|
@ -111,8 +109,7 @@ class Subscriptions extends DolibarrApi
|
|||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
|
@ -121,12 +118,10 @@ class Subscriptions extends DolibarrApi
|
|||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < min($limit, $num))
|
||||
{
|
||||
while ($i < min($limit, $num)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$subscription = new Subscription($this->db);
|
||||
if ($subscription->fetch($obj->rowid)) {
|
||||
|
|
@ -134,8 +129,7 @@ class Subscriptions extends DolibarrApi
|
|||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror());
|
||||
}
|
||||
if (!count($obj_ret)) {
|
||||
|
|
@ -193,13 +187,10 @@ class Subscriptions extends DolibarrApi
|
|||
$subscription->$field = $value;
|
||||
}
|
||||
|
||||
if ($subscription->update(DolibarrApiAccess::$user) > 0)
|
||||
{
|
||||
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
|
||||
return $this->get($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, $subscription->error);
|
||||
} else {
|
||||
throw new RestException(500, $subscription->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,8 +136,7 @@ class Subscription extends CommonObject
|
|||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
if ($this->datef <= $this->dateh)
|
||||
{
|
||||
if ($this->datef <= $this->dateh) {
|
||||
$this->error = $langs->trans("ErrorBadValueForDate");
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -169,14 +168,12 @@ class Subscription extends CommonObject
|
|||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
$this->fk_type = $type;
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
if (!$error && !$notrigger) {
|
||||
$this->context = array('member'=>$member);
|
||||
// Call triggers
|
||||
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
|
||||
|
|
@ -213,10 +210,8 @@ class Subscription extends CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
|
@ -232,14 +227,10 @@ class Subscription extends CommonObject
|
|||
$this->note = $obj->note;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -272,8 +263,7 @@ class Subscription extends CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$member = new Adherent($this->db);
|
||||
$result = $member->fetch($this->fk_adherent);
|
||||
|
|
@ -286,9 +276,7 @@ class Subscription extends CommonObject
|
|||
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
|
@ -315,8 +303,7 @@ class Subscription extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
// It subscription is linked to a bank transaction, we get it
|
||||
if ($this->fk_bank > 0)
|
||||
{
|
||||
if ($this->fk_bank > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$accountline = new AccountLine($this->db);
|
||||
$result = $accountline->fetch($this->fk_bank);
|
||||
|
|
@ -333,50 +320,37 @@ class Subscription extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $this->db->affected_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$member = new Adherent($this->db);
|
||||
$result = $member->fetch($this->fk_adherent);
|
||||
$result = $member->update_end_date($user);
|
||||
|
||||
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||
{
|
||||
$result = $accountline->delete($user); // Return false if refused because line is conciliated
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
|
||||
$result = $accountline->delete($user); // Return false if refused because line is conciliated
|
||||
if ($result > 0) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->error = $accountline->error;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
|
@ -414,8 +388,7 @@ class Subscription extends CommonObject
|
|||
|
||||
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||
|
|
@ -476,10 +449,8 @@ class Subscription extends CommonObject
|
|||
$sql .= ' WHERE c.rowid = '.$id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
|
|
@ -488,9 +459,7 @@ class Subscription extends CommonObject
|
|||
}
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ $form = new Form($db);
|
|||
$object = new Adherent($db);
|
||||
$membert = new AdherentType($db);
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -86,16 +85,13 @@ $title = $langs->trans("Member")." - ".$langs->trans("Documents");
|
|||
$helpurl = "EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("", $title, $helpurl);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($id > 0) {
|
||||
$result = $membert->fetch($object->typeid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file)
|
||||
{
|
||||
foreach ($filearray as $key => $file) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
|
|
@ -118,8 +114,7 @@ if ($id > 0)
|
|||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -158,14 +153,10 @@ if ($id > 0)
|
|||
$param = '&id='.$object->id;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
print "<br><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,13 +40,11 @@ $now = dol_now();
|
|||
|
||||
if (empty($sortorder)) { $sortorder = "ASC"; }
|
||||
if (empty($sortfield)) { $sortfield = "d.login"; }
|
||||
if (!isset($statut))
|
||||
{
|
||||
if (!isset($statut)) {
|
||||
$statut = 1;
|
||||
}
|
||||
|
||||
if (!isset($cotis))
|
||||
{
|
||||
if (!isset($cotis)) {
|
||||
// by default, members must be up to date of subscription
|
||||
$cotis = 1;
|
||||
}
|
||||
|
|
@ -55,33 +53,28 @@ if (!isset($cotis))
|
|||
$sql = "SELECT d.login, d.pass, d.datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
|
||||
$sql .= " WHERE d.statut = ".$statut;
|
||||
if ($cotis == 1)
|
||||
{
|
||||
if ($cotis == 1) {
|
||||
$sql .= " AND datefin > '".$db->idate($now)."'";
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
//$sql.=$db->plimit($conf->liste_limit, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0);
|
||||
|
||||
print "<hr>\n";
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$htpass = crypt($objp->pass, makesalt());
|
||||
print $objp->login.":".$htpass."<br>\n";
|
||||
$i++;
|
||||
}
|
||||
print "<hr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* \file htdocs/adherents/index.php
|
||||
* \ingroup member
|
||||
* \brief Page accueil module adherents
|
||||
* \brief Home page of membership module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
|
@ -73,12 +73,10 @@ $sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
|||
|
||||
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$adhtype = new AdherentType($db);
|
||||
|
|
@ -110,12 +108,10 @@ $sql .= " GROUP BY d.fk_adherent_type";
|
|||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
|
|
@ -127,23 +123,19 @@ if ($result)
|
|||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
||||
{
|
||||
// Search contact/address
|
||||
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire)
|
||||
{
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
|
||||
// Search contact/address
|
||||
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
|
||||
$listofsearchfields['search_member'] = array('text'=>'Member');
|
||||
}
|
||||
|
||||
if (count($listofsearchfields))
|
||||
{
|
||||
if (count($listofsearchfields)) {
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
$i = 0;
|
||||
foreach ($listofsearchfields as $key => $value)
|
||||
{
|
||||
foreach ($listofsearchfields as $key => $value) {
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
|
|
@ -163,8 +155,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
|
|||
* Statistics
|
||||
*/
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
|
|
@ -177,8 +168,7 @@ if ($conf->use_javascript_ajax)
|
|||
$total = 0;
|
||||
$dataval = array();
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
|
||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
|
||||
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
|
||||
|
|
@ -232,12 +222,10 @@ $sql .= " AND d.rowid = c.fk_adherent";
|
|||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$year = dol_print_date($db->jdate($objp->dateh), "%Y");
|
||||
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
||||
|
|
@ -259,10 +247,8 @@ print "</tr>\n";
|
|||
|
||||
krsort($Total);
|
||||
$i = 0;
|
||||
foreach ($Total as $key=>$value)
|
||||
{
|
||||
if ($i >= 8)
|
||||
{
|
||||
foreach ($Total as $key=>$value) {
|
||||
if ($i >= 8) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>...</td>";
|
||||
print "<td class=\"right\"></td>";
|
||||
|
|
@ -308,38 +294,32 @@ $sql .= $db->order("a.tms", "DESC");
|
|||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven">';
|
||||
$staticmember->id = $obj->rowid;
|
||||
$staticmember->lastname = $obj->lastname;
|
||||
$staticmember->firstname = $obj->firstname;
|
||||
if (!empty($obj->fk_soc))
|
||||
{
|
||||
if (!empty($obj->fk_soc)) {
|
||||
$staticmember->fk_soc = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name = $staticmember->thirdparty->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$staticmember->name = $obj->company;
|
||||
}
|
||||
$staticmember->ref = $staticmember->getFullName($langs);
|
||||
$statictype->id = $obj->typeid;
|
||||
$statictype->label = $obj->label;
|
||||
print '<td>'.$staticmember->getNomUrl(1, 32).'</td>';
|
||||
print '<td class="nowraponall">'.$staticmember->getNomUrl(1, 32).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
|
||||
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).'</td>';
|
||||
|
|
@ -349,9 +329,7 @@ if ($resql)
|
|||
}
|
||||
print "</table></div>";
|
||||
print "<br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
@ -371,19 +349,16 @@ $sql .= $db->order("c.tms", "DESC");
|
|||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven">';
|
||||
$subscriptionstatic->id = $obj->cid;
|
||||
|
|
@ -399,21 +374,19 @@ if ($resql)
|
|||
$staticmember->name = $obj->company;
|
||||
}
|
||||
$staticmember->ref = $staticmember->getFullName($langs);
|
||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1, 32, 'subscription').'</td>';
|
||||
print '<td>'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';
|
||||
print '<td class="nowraponall">'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$staticmember->getNomUrl(1, 32, 'subscription').'</td>';
|
||||
print '<td class="nowraponall">'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';
|
||||
print '<td class="right">'.price($obj->subscription).'</td>';
|
||||
//print '<td class="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'</td>';
|
||||
print '<td class="right nowraponall">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table></div>";
|
||||
print "<br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
@ -429,8 +402,7 @@ print '<th class=right>'.$langs->trans("MenuMembersUpToDate").'</th>';
|
|||
print '<th class=right>'.$langs->trans("MembersStatusResiliated").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
||||
print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
|
|
|
|||
|
|
@ -37,15 +37,13 @@ $action = GETPOST('action', 'aZ09');
|
|||
|
||||
// Protection
|
||||
$socid = 0;
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($rowid);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
dol_print_error($db, "Failed to get adherent: ".$object->error);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -55,13 +53,11 @@ if (!$result)
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'dolibarr2ldap')
|
||||
{
|
||||
if ($action == 'dolibarr2ldap') {
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
$olddn = $dn; // We can say that old dn = dn as we force synchro
|
||||
|
|
@ -71,8 +67,7 @@ if ($action == 'dolibarr2ldap')
|
|||
|
||||
if ($result >= 0) {
|
||||
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
|
@ -104,8 +99,7 @@ print '<table class="border centpercent tableforfield">';
|
|||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
|
||||
// If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else
|
||||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
|
||||
{
|
||||
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) {
|
||||
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
|
||||
print '<td class="valeur">'.$object->pass.'</td>';
|
||||
print "</tr>\n";
|
||||
|
|
@ -142,8 +136,7 @@ dol_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) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
|
||||
}
|
||||
|
||||
|
|
@ -166,46 +159,34 @@ print '</tr>';
|
|||
// Lecture LDAP
|
||||
$ldap = new Ldap();
|
||||
$result = $ldap->connect_bind();
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info, 1);
|
||||
$search = "(".$object->_load_ldap_dn($info, 2).")";
|
||||
|
||||
if (empty($dn))
|
||||
{
|
||||
if (empty($dn)) {
|
||||
$langs->load("errors");
|
||||
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$records = $ldap->getAttribute($dn, $search);
|
||||
|
||||
//print_r($records);
|
||||
|
||||
// Show tree
|
||||
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0))
|
||||
{
|
||||
if (!is_array($records))
|
||||
{
|
||||
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
|
||||
if (!is_array($records)) {
|
||||
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$result = show_ldap_content($records, 0, $records['count'], true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($ldap->error, $ldap->errors, 'errors');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,10 +141,8 @@ $arrayfields = array(
|
|||
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
}
|
||||
|
|
@ -162,14 +160,12 @@ $parameters = array('socid'=>$socid);
|
|||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$search = "";
|
||||
$search_ref = "";
|
||||
$search_lastname = "";
|
||||
|
|
@ -198,37 +194,29 @@ if (empty($reshook))
|
|||
}
|
||||
|
||||
// Close
|
||||
if ($massaction == 'close' && $user->rights->adherent->creer)
|
||||
{
|
||||
if ($massaction == 'close' && $user->rights->adherent->creer) {
|
||||
$tmpmember = new Adherent($db);
|
||||
$error = 0;
|
||||
$nbclose = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
foreach ($toselect as $idtoclose)
|
||||
{
|
||||
foreach ($toselect as $idtoclose) {
|
||||
$tmpmember->fetch($idtoclose);
|
||||
$result = $tmpmember->resiliate($user);
|
||||
|
||||
if ($result < 0 && !count($tmpmember->errors))
|
||||
{
|
||||
if ($result < 0 && !count($tmpmember->errors)) {
|
||||
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($result > 0) $nbclose++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
|
||||
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
|
@ -286,8 +274,7 @@ $sql .= " AND d.entity IN (".getEntity('adherent').")";
|
|||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type);
|
||||
if ($statut != '') $sql .= " AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
if ($search_ref)
|
||||
{
|
||||
if ($search_ref) {
|
||||
if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")";
|
||||
else $sql .= " AND 1 = 2"; // Always wrong
|
||||
}
|
||||
|
|
@ -301,6 +288,9 @@ if ($search_email) $sql .= natural_search("d.email", $search_email);
|
|||
if ($search_town) $sql .= natural_search("d.town", $search_town);
|
||||
if ($search_zip) $sql .= natural_search("d.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_phone) $sql .= natural_search("d.phone", $search_phone);
|
||||
if ($search_phone_perso) $sql .= natural_search("d.phone_perso", $search_phone_perso);
|
||||
if ($search_phone_mobile) $sql .= natural_search("d.phone_mobile", $search_phone_mobile);
|
||||
if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
|
||||
if ($filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
|
||||
if ($filter == 'outofdate') $sql .= " AND ((datefin IS NULL OR datefin < '".$db->idate($now)."') AND t.subscription = 1)";
|
||||
|
|
@ -317,13 +307,11 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) $nbtotalofrecords = $db->num_rows($resql);
|
||||
else dol_print_error($db);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
|
@ -333,8 +321,7 @@ $sql .= $db->plimit($limit + 1, $offset);
|
|||
|
||||
dol_syslog("get list", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -343,8 +330,7 @@ $num = $db->num_rows($resql);
|
|||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||
{
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
|
||||
|
|
@ -354,22 +340,18 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
|||
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$titre = $langs->trans("MembersList");
|
||||
if (GETPOSTISSET("statut"))
|
||||
{
|
||||
if (GETPOSTISSET("statut")) {
|
||||
if ($statut == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
|
||||
if ($statut == '-1') { $titre = $langs->trans("MembersListToValid"); }
|
||||
if ($statut == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); }
|
||||
if ($statut == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); }
|
||||
if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
|
||||
if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); }
|
||||
}
|
||||
elseif ($action == 'search')
|
||||
{
|
||||
} elseif ($action == 'search') {
|
||||
$titre = $langs->trans("MembersListQualified");
|
||||
}
|
||||
|
||||
if ($search_type > 0)
|
||||
{
|
||||
if ($search_type > 0) {
|
||||
$membertype = new AdherentType($db);
|
||||
$result = $membertype->fetch(GETPOST("type", 'int'));
|
||||
$titre .= " (".$membertype->label.")";
|
||||
|
|
@ -413,8 +395,7 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions =
|
|||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
if ($user->rights->adherent->creer) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
|
||||
}
|
||||
|
||||
|
|
@ -435,16 +416,14 @@ $objecttmp = new Adherent($db);
|
|||
$trackid = 'mem'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
if ($sall) {
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Categories').': ';
|
||||
|
|
@ -455,8 +434,7 @@ $parameters = array();
|
|||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
|
|
@ -474,120 +452,100 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
|||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Line numbering
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.civility']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.civility']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.gender']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.gender']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
|
||||
print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.company']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.morphy']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$listetype = $membertypestatic->liste_array();
|
||||
print $form->selectarray("search_type", $listetype, $type, 1, 0, 0, '', 0, 32);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.address']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.$search_address.'"></td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.zip']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.town']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.$search_town.'"></td>';
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Phone pro
|
||||
if (!empty($arrayfields['d.phone']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.phone']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.$search_phone.'"></td>';
|
||||
}
|
||||
// Phone perso
|
||||
if (!empty($arrayfields['d.phone_perso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.phone_perso']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.$search_phone_perso.'"></td>';
|
||||
}
|
||||
// Phone mobile
|
||||
if (!empty($arrayfields['d.phone_mobile']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'"></td>';
|
||||
}
|
||||
// Email
|
||||
if (!empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.email']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.$search_email.'"></td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.datefin']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -599,26 +557,22 @@ $parameters = array('arrayfields'=>$arrayfields);
|
|||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.datec']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
//Birthday
|
||||
if (!empty($arrayfields['d.birth']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.birth']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.tms']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['d.statut']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.statut']['checked'])) {
|
||||
print '<td class="liste_titre right maxwidthonsmartphone">';
|
||||
$liststatus = array(
|
||||
'-1'=>$langs->trans("Draft"),
|
||||
|
|
@ -673,8 +627,7 @@ print "</tr>\n";
|
|||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$datefin = $db->jdate($obj->datefin);
|
||||
|
|
@ -702,74 +655,64 @@ while ($i < min($num, $limit))
|
|||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="center">'.$obj->rowid.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Civility
|
||||
if (!empty($arrayfields['d.civility']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.civility']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->civility;
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->firstname;
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Lastname
|
||||
if (!empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->lastname;
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Gender
|
||||
if (!empty($arrayfields['d.gender']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.gender']['checked'])) {
|
||||
print '<td>';
|
||||
if ($obj->gender) print $langs->trans("Gender".$obj->gender);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Company
|
||||
if (!empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.company']['checked'])) {
|
||||
print "<td>";
|
||||
print $companyname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Login
|
||||
if (!empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print "<td>".$obj->login."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Moral/Physique
|
||||
if (!empty($arrayfields['d.morphy']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.morphy']['checked'])) {
|
||||
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type label
|
||||
if (!empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
$membertypestatic->id = $obj->type_id;
|
||||
$membertypestatic->label = $obj->type;
|
||||
print '<td class="nowrap">';
|
||||
|
|
@ -778,38 +721,33 @@ while ($i < min($num, $limit))
|
|||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Address
|
||||
if (!empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.address']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->address;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (!empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.zip']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.town']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="center">';
|
||||
$tmparray = getCountry($obj->country, 'all');
|
||||
print $tmparray['label'];
|
||||
|
|
@ -817,40 +755,34 @@ while ($i < min($num, $limit))
|
|||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone pro
|
||||
if (!empty($arrayfields['d.phone']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.phone']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->phone;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone perso
|
||||
if (!empty($arrayfields['d.phone_perso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.phone_perso']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->phone_perso;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone mobile
|
||||
if (!empty($arrayfields['d.phone_mobile']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->phone_mobile;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// EMail
|
||||
if (!empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.email']['checked'])) {
|
||||
print "<td>".dol_print_email($obj->email, 0, 0, 1)."</td>\n";
|
||||
}
|
||||
// End of subscription date
|
||||
$datefin = $db->jdate($obj->datefin);
|
||||
if (!empty($arrayfields['d.datefin']['checked']))
|
||||
{
|
||||
if ($datefin)
|
||||
{
|
||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||
if ($datefin) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($datefin, 'day');
|
||||
if ($memberstatic->hasDelay()) {
|
||||
|
|
@ -858,17 +790,12 @@ while ($i < min($num, $limit))
|
|||
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<td class="nowrap left">';
|
||||
if ($obj->subscription == 'yes')
|
||||
{
|
||||
if ($obj->subscription == 'yes') {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($obj->statut > 0) print " ".img_warning();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -877,36 +804,32 @@ while ($i < min($num, $limit))
|
|||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['d.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.datec']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Birth
|
||||
if (!empty($arrayfields['d.birth']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.birth']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['d.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.tms']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['d.statut']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.statut']['checked'])) {
|
||||
print '<td class="nowrap right">';
|
||||
print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
|
||||
print '</td>';
|
||||
|
|
@ -914,8 +837,7 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
// Action column
|
||||
print '<td class="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
|
|
@ -932,8 +854,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ $result = restrictedArea($user, 'adherent', $id);
|
|||
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$adht = new AdherentType($db);
|
||||
$result = $adht->fetch($object->typeid);
|
||||
}
|
||||
|
|
@ -64,8 +63,7 @@ llxHeader("", $title, $helpurl);
|
|||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
if ($id) {
|
||||
$head = member_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user');
|
||||
|
|
@ -83,8 +81,7 @@ if ($id)
|
|||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
|
|||
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
|
@ -77,12 +76,10 @@ $foundphy = $foundmor = 0;
|
|||
// Define $data array
|
||||
dol_syslog("Count member", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($obj->code == 'phy') $foundphy++;
|
||||
|
|
@ -93,9 +90,7 @@ if ($resql)
|
|||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
|
@ -106,13 +101,10 @@ dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'use
|
|||
|
||||
|
||||
// Print title
|
||||
if (!count($data))
|
||||
{
|
||||
if (!count($data)) {
|
||||
print $langs->trans("NoValidatedMemberYet").'<br>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $langs->trans("MembersByNature").'<br>';
|
||||
print '<br>';
|
||||
}
|
||||
|
|
@ -129,8 +121,7 @@ print '</tr>';
|
|||
if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
|
||||
if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
|
||||
|
||||
foreach ($data as $val)
|
||||
{
|
||||
foreach ($data as $val) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
|
|||
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
|
@ -68,11 +67,9 @@ print load_fiche_titre($title, '', 'object_group');
|
|||
|
||||
dol_mkdir($dir);
|
||||
|
||||
if ($mode)
|
||||
{
|
||||
if ($mode) {
|
||||
// Define sql
|
||||
if ($mode == 'memberbycountry')
|
||||
{
|
||||
if ($mode == 'memberbycountry') {
|
||||
$label = $langs->trans("Country");
|
||||
$tab = 'statscountry';
|
||||
|
||||
|
|
@ -87,8 +84,7 @@ if ($mode)
|
|||
//print $sql;
|
||||
}
|
||||
|
||||
if ($mode == 'memberbystate')
|
||||
{
|
||||
if ($mode == 'memberbystate') {
|
||||
$label = $langs->trans("Country");
|
||||
$label2 = $langs->trans("State");
|
||||
$tab = 'statsstate';
|
||||
|
|
@ -105,9 +101,8 @@ if ($mode)
|
|||
$sql .= " GROUP BY co.label, co.code, c.nom";
|
||||
//print $sql;
|
||||
}
|
||||
if ($mode == 'memberbyregion') //
|
||||
{
|
||||
$label = $langs->trans("Country");
|
||||
if ($mode == 'memberbyregion') { //
|
||||
$label = $langs->trans("Country");
|
||||
$label2 = $langs->trans("Region"); //département
|
||||
$tab = 'statsregion'; //onglet
|
||||
|
||||
|
|
@ -123,8 +118,7 @@ if ($mode)
|
|||
$sql .= " GROUP BY co.label, co.code, r.nom"; //+
|
||||
//print $sql;
|
||||
}
|
||||
if ($mode == 'memberbytown')
|
||||
{
|
||||
if ($mode == 'memberbytown') {
|
||||
$label = $langs->trans("Country");
|
||||
$label2 = $langs->trans("Town");
|
||||
$tab = 'statstown';
|
||||
|
|
@ -148,15 +142,12 @@ if ($mode)
|
|||
// Define $data array
|
||||
dol_syslog("Count member", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($mode == 'memberbycountry')
|
||||
{
|
||||
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,
|
||||
|
|
@ -165,9 +156,8 @@ if ($mode)
|
|||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbyregion') //+
|
||||
{
|
||||
$data[] = array(
|
||||
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")),
|
||||
|
|
@ -176,8 +166,7 @@ if ($mode)
|
|||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbystate')
|
||||
{
|
||||
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")),
|
||||
|
|
@ -186,8 +175,7 @@ if ($mode)
|
|||
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
|
||||
);
|
||||
}
|
||||
if ($mode == 'memberbytown')
|
||||
{
|
||||
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")),
|
||||
|
|
@ -200,9 +188,7 @@ if ($mode)
|
|||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
|
@ -214,19 +200,15 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
|
|||
|
||||
|
||||
// Print title
|
||||
if ($mode && !count($data))
|
||||
{
|
||||
if ($mode && !count($data)) {
|
||||
print $langs->trans("NoValidatedMemberYet").'<br>';
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'<br>';
|
||||
elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'<br>';
|
||||
elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'<br>';
|
||||
elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'<br>'; //+
|
||||
else
|
||||
{
|
||||
else {
|
||||
print $langs->trans("MembersStatisticsDesc").'<br>';
|
||||
print '<br>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>';
|
||||
|
|
@ -242,8 +224,7 @@ else
|
|||
|
||||
|
||||
// Show graphics
|
||||
if (count($arrayjs) && $mode == 'memberbycountry')
|
||||
{
|
||||
if (count($arrayjs) && $mode == 'memberbycountry') {
|
||||
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
if (is_readable($color_file)) include_once $color_file;
|
||||
|
||||
|
|
@ -261,8 +242,7 @@ if (count($arrayjs) && $mode == 'memberbycountry')
|
|||
|
||||
// loop and dump
|
||||
$i = 0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
foreach ($data as $val) {
|
||||
$valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
|
||||
//$valcountry=ucfirst($val['label_en']);
|
||||
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
|
||||
|
|
@ -291,8 +271,7 @@ if (count($arrayjs) && $mode == 'memberbycountry')
|
|||
print '<br>';
|
||||
}
|
||||
|
||||
if ($mode)
|
||||
{
|
||||
if ($mode) {
|
||||
// Print array / Affiche le tableau
|
||||
print '<table class="liste centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
|
@ -303,8 +282,7 @@ if ($mode)
|
|||
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
foreach ($data as $val)
|
||||
{
|
||||
foreach ($data as $val) {
|
||||
$year = $val['year'];
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$val['label'].'</td>';
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ $userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
|
|||
$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
|
@ -79,12 +78,10 @@ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscripti
|
|||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
if (!$mesg) {
|
||||
$px1->SetData($data);
|
||||
$i = $startyear;
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
while ($i <= $endyear) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -112,12 +109,10 @@ $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscr
|
|||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
if (!$mesg) {
|
||||
$px2->SetData($data);
|
||||
$i = $startyear;
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
while ($i <= $endyear) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -175,11 +170,9 @@ print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
|
|||
print '</tr>';
|
||||
|
||||
$oldyear = 0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
foreach ($data as $val) {
|
||||
$year = $val['year'];
|
||||
while ($oldyear > $year + 1)
|
||||
{ // If we have empty year
|
||||
while ($oldyear > $year + 1) { // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td class="center">';
|
||||
|
|
@ -214,8 +207,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|||
|
||||
// Show graphs
|
||||
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
|
||||
if ($mesg) { print $mesg; }
|
||||
else {
|
||||
if ($mesg) { print $mesg; } else {
|
||||
print $px1->show();
|
||||
print "<br>\n";
|
||||
print $px2->show();
|
||||
|
|
|
|||
|
|
@ -75,16 +75,14 @@ $errmsg = '';
|
|||
$defaultdelay = 1;
|
||||
$defaultdelayunit = 'y';
|
||||
|
||||
if ($rowid)
|
||||
{
|
||||
if ($rowid) {
|
||||
// Load member
|
||||
$result = $object->fetch($rowid);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $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)
|
||||
{
|
||||
if ($object->user_id) {
|
||||
// $user is the user editing, $object->user_id is the user's id linked to the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
|
|
@ -96,8 +94,7 @@ if ($rowid)
|
|||
// Define variables to know what current user can do on members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
// Define variables to know what current user can do on properties of a member
|
||||
if ($rowid)
|
||||
{
|
||||
if ($rowid) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
}
|
||||
|
||||
|
|
@ -115,47 +112,35 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($con
|
|||
*/
|
||||
|
||||
// Create third party from a member
|
||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
|
||||
{
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) {
|
||||
if ($result > 0) {
|
||||
// Creation of thirdparty
|
||||
$company = new Societe($db);
|
||||
$result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'), GETPOST('customercode', 'alpha'));
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($company->error, $company->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$action = 'addsubscription';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||
{
|
||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) {
|
||||
$error = 0;
|
||||
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
|
||||
{
|
||||
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
|
||||
{
|
||||
if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only
|
||||
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
|
||||
{
|
||||
$result = $object->setUserId($_POST["userid"]);
|
||||
if (!$error) {
|
||||
if ($_POST["userid"] != $object->user_id) { // If link differs from currently in database
|
||||
$result = $object->setUserId($_POST["userid"]);
|
||||
if ($result < 0) dol_print_error('', $object->error);
|
||||
$_POST['action'] = '';
|
||||
$action = '';
|
||||
|
|
@ -163,21 +148,16 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setsocid')
|
||||
{
|
||||
if ($action == 'setsocid') {
|
||||
$error = 0;
|
||||
if (!$error)
|
||||
{
|
||||
if (GETPOST('socid', 'int') != $object->fk_soc) // If link differs from currently in database
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
if (!$error) {
|
||||
if (GETPOST('socid', 'int') != $object->fk_soc) { // If link differs from currently in database
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE fk_soc = '".GETPOST('socid', 'int')."'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj && $obj->rowid > 0)
|
||||
{
|
||||
if ($obj && $obj->rowid > 0) {
|
||||
$othermember = new Adherent($db);
|
||||
$othermember->fetch($obj->rowid);
|
||||
$thirdparty = new Societe($db);
|
||||
|
|
@ -187,8 +167,7 @@ if ($action == 'setsocid')
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $object->setThirdPartyId(GETPOST('socid', 'int'));
|
||||
if ($result < 0) dol_print_error('', $object->error);
|
||||
$_POST['action'] = '';
|
||||
|
|
@ -198,8 +177,7 @@ if ($action == 'setsocid')
|
|||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !$_POST["cancel"])
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !$_POST["cancel"]) {
|
||||
$error = 0;
|
||||
|
||||
$langs->load("banks");
|
||||
|
|
@ -211,16 +189,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
$datesubscription = 0;
|
||||
$datesubend = 0;
|
||||
$paymentdate = 0;
|
||||
if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"])
|
||||
{
|
||||
if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) {
|
||||
$datesubscription = dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
}
|
||||
if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"])
|
||||
{
|
||||
if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"]) {
|
||||
$datesubend = dol_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
}
|
||||
if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"])
|
||||
{
|
||||
if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"]) {
|
||||
$paymentdate = dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
|
||||
}
|
||||
$amount = price2num(GETPOST("subscription", 'alpha')); // Amount of subscription
|
||||
|
|
@ -237,28 +212,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
$sendalsoemail = GETPOST("sendmail", 'alpha');
|
||||
|
||||
// Check parameters
|
||||
if (!$datesubscription)
|
||||
{
|
||||
if (!$datesubscription) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg = $langs->trans("ErrorBadDateFormat", $langs->transnoentitiesnoconv("DateSubscription"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action = 'addsubscription';
|
||||
}
|
||||
if (GETPOST('end') && !$datesubend)
|
||||
{
|
||||
if (GETPOST('end') && !$datesubend) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg = $langs->trans("ErrorBadDateFormat", $langs->transnoentitiesnoconv("DateEndSubscription"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action = 'addsubscription';
|
||||
}
|
||||
if (!$datesubend)
|
||||
{
|
||||
if (!$datesubend) {
|
||||
$datesubend = dol_time_plus_duree(dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit), -1, 'd');
|
||||
}
|
||||
if (($option == 'bankviainvoice' || $option == 'bankdirect') && !$paymentdate)
|
||||
{
|
||||
if (($option == 'bankviainvoice' || $option == 'bankdirect') && !$paymentdate) {
|
||||
$error++;
|
||||
$errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
|
|
@ -266,32 +237,23 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
}
|
||||
|
||||
// Check if a payment is mandatory or not
|
||||
if (!$error && $adht->subscription) // Member type need subscriptions
|
||||
{
|
||||
if (!is_numeric($amount))
|
||||
{
|
||||
if (!$error && $adht->subscription) { // Member type need subscriptions
|
||||
if (!is_numeric($amount)) {
|
||||
// If field is '' or not a numeric value
|
||||
$errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
$action = 'addsubscription';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none')
|
||||
{
|
||||
if ($_POST["subscription"])
|
||||
{
|
||||
} else {
|
||||
if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') {
|
||||
if ($_POST["subscription"]) {
|
||||
if (!$_POST["label"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
|
||||
if ($_POST["paymentsave"] != 'invoiceonly' && !$_POST["operation"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
|
||||
if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
|
||||
}
|
||||
if ($errmsg)
|
||||
{
|
||||
if ($errmsg) {
|
||||
$error++;
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
|
|
@ -302,55 +264,43 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
}
|
||||
|
||||
// Record the subscription then complementary actions
|
||||
if (!$error && $action == 'subscription')
|
||||
{
|
||||
if (!$error && $action == 'subscription') {
|
||||
$db->begin();
|
||||
|
||||
// Create subscription
|
||||
$crowid = $object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
|
||||
if ($crowid <= 0)
|
||||
{
|
||||
if ($crowid <= 0) {
|
||||
$error++;
|
||||
$errmsg = $object->error;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// If an invoice was created, it is into $object->invoice
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
$action = 'addsubscription';
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
setEventMessages("SubscriptionRecorded", null, 'mesgs');
|
||||
}
|
||||
|
||||
// Send email
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
// Send confirmation Email
|
||||
if ($object->email && $sendalsoemail) // $object is 'Adherent'
|
||||
{
|
||||
$subject = '';
|
||||
if ($object->email && $sendalsoemail) { // $object is 'Adherent'
|
||||
$subject = '';
|
||||
$msg = '';
|
||||
|
||||
// Send subscription email
|
||||
|
|
@ -368,8 +318,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
|
||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
||||
{
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
|
@ -384,8 +333,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
$listofpaths = array();
|
||||
$listofnames = array();
|
||||
$listofmimes = array();
|
||||
if (is_object($object->invoice))
|
||||
{
|
||||
if (is_object($object->invoice)) {
|
||||
$invoicediroutput = $conf->facture->dir_output;
|
||||
$fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
|
@ -398,25 +346,19 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$errmsg = $object->error;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
// Clean some POST vars
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$_POST["subscription"] = '';
|
||||
$_POST["accountid"] = '';
|
||||
$_POST["operation"] = '';
|
||||
|
|
@ -450,8 +392,7 @@ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
|||
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
|
||||
if ($rowid > 0)
|
||||
{
|
||||
if ($rowid > 0) {
|
||||
$res = $object->fetch($rowid);
|
||||
if ($res < 0) { dol_print_error($db, $object->error); exit; }
|
||||
|
||||
|
|
@ -480,8 +421,7 @@ if ($rowid > 0)
|
|||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -500,11 +440,9 @@ if ($rowid > 0)
|
|||
print '</tr>';
|
||||
|
||||
// Password
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
|
||||
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id))
|
||||
{
|
||||
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
|
||||
$langs->load("errors");
|
||||
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
||||
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
|
|
@ -527,8 +465,7 @@ if ($rowid > 0)
|
|||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire))
|
||||
{
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
|
|
@ -541,22 +478,16 @@ if ($rowid > 0)
|
|||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||
if ($object->datefin)
|
||||
{
|
||||
if ($object->datefin) {
|
||||
print dol_print_date($object->datefin, 'day');
|
||||
if ($object->hasDelay()) {
|
||||
print " ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$adht->subscription)
|
||||
{
|
||||
} else {
|
||||
if (!$adht->subscription) {
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
||||
}
|
||||
|
|
@ -564,8 +495,7 @@ if ($rowid > 0)
|
|||
print '</td></tr>';
|
||||
|
||||
// Third party Dolibarr
|
||||
if (!empty($conf->societe->enabled))
|
||||
{
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrThirdParty");
|
||||
|
|
@ -573,8 +503,7 @@ if ($rowid > 0)
|
|||
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editthirdparty')
|
||||
{
|
||||
if ($action == 'editthirdparty') {
|
||||
$htmlname = 'socid';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||
|
|
@ -586,17 +515,12 @@ if ($rowid > 0)
|
|||
print '</td>';
|
||||
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->fk_soc)
|
||||
{
|
||||
} else {
|
||||
if ($object->fk_soc) {
|
||||
$company = new Societe($db);
|
||||
$result = $company->fetch($object->fk_soc);
|
||||
print $company->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $langs->trans("NoThirdPartyAssociatedToMember");
|
||||
}
|
||||
}
|
||||
|
|
@ -608,28 +532,21 @@ if ($rowid > 0)
|
|||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrUser");
|
||||
print '</td>';
|
||||
if ($action != 'editlogin' && $user->rights->adherent->creer)
|
||||
{
|
||||
if ($action != 'editlogin' && $user->rights->adherent->creer) {
|
||||
print '<td class="right">';
|
||||
if ($user->rights->user->user->creer)
|
||||
{
|
||||
if ($user->rights->user->user->creer) {
|
||||
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editlogin')
|
||||
{
|
||||
if ($action == 'editlogin') {
|
||||
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->user_id)
|
||||
{
|
||||
} else {
|
||||
if ($object->user_id) {
|
||||
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
|
||||
}
|
||||
else print $langs->trans("NoDolibarrAccess");
|
||||
} else print $langs->trans("NoDolibarrAccess");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -648,10 +565,8 @@ if ($rowid > 0)
|
|||
*/
|
||||
|
||||
// Button to create a new subscription if member no draft neither resiliated
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if ($action != 'addsubscription' && $action != 'create_thirdparty')
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
||||
|
|
@ -664,8 +579,7 @@ if ($rowid > 0)
|
|||
/*
|
||||
* List of subscriptions
|
||||
*/
|
||||
if ($action != 'addsubscription' && $action != 'create_thirdparty')
|
||||
{
|
||||
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
|
||||
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,";
|
||||
$sql .= " c.rowid as crowid, c.subscription,";
|
||||
$sql .= " c.datec, c.fk_type as cfk_type,";
|
||||
|
|
@ -681,8 +595,7 @@ if ($rowid > 0)
|
|||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$subscriptionstatic = new Subscription($db);
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
|
@ -696,8 +609,7 @@ if ($rowid > 0)
|
|||
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
|
@ -707,8 +619,7 @@ if ($rowid > 0)
|
|||
$adht = new AdherentType($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$adh->id = $objp->rowid;
|
||||
|
|
@ -718,8 +629,7 @@ if ($rowid > 0)
|
|||
$subscriptionstatic->id = $objp->crowid;
|
||||
|
||||
$typeid = ($objp->cfk_type > 0 ? $objp->cfk_type : $adh->typeid);
|
||||
if ($typeid > 0)
|
||||
{
|
||||
if ($typeid > 0) {
|
||||
$adht->fetch($typeid);
|
||||
}
|
||||
|
||||
|
|
@ -734,19 +644,16 @@ if ($rowid > 0)
|
|||
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
|
||||
print '<td class="right">'.price($objp->subscription).'</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td class="right">';
|
||||
if ($objp->bid)
|
||||
{
|
||||
if ($objp->bid) {
|
||||
$accountstatic->label = $objp->label;
|
||||
$accountstatic->id = $objp->baid;
|
||||
$accountstatic->number = $objp->number;
|
||||
$accountstatic->account_number = $objp->account_number;
|
||||
$accountstatic->currency_code = $objp->currency_code;
|
||||
|
||||
if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0)
|
||||
{
|
||||
if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) {
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objp->fk_accountancy_journal);
|
||||
|
||||
|
|
@ -755,9 +662,7 @@ if ($rowid > 0)
|
|||
|
||||
$accountstatic->ref = $objp->ref;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -773,21 +678,17 @@ if ($rowid > 0)
|
|||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($action != 'addsubscription' && $action != 'create_thirdparty'))
|
||||
{
|
||||
if (($action != 'addsubscription' && $action != 'create_thirdparty')) {
|
||||
// Shon online payment link
|
||||
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
|
||||
|
||||
if ($useonlinepayment)
|
||||
{
|
||||
if ($useonlinepayment) {
|
||||
print '<br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
|
|
@ -799,8 +700,7 @@ if ($rowid > 0)
|
|||
/*
|
||||
* Add new subscription form
|
||||
*/
|
||||
if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer) {
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewCotisation"));
|
||||
|
|
@ -809,14 +709,11 @@ if ($rowid > 0)
|
|||
$bankdirect = 0; // 1 means option by default is write to bank direct with no invoice
|
||||
$invoiceonly = 0; // 1 means option by default is invoice only
|
||||
$bankviainvoice = 0; // 1 means option by default is write to bank via invoice
|
||||
if (GETPOST('paymentsave'))
|
||||
{
|
||||
if (GETPOST('paymentsave')) {
|
||||
if (GETPOST('paymentsave') == 'bankdirect') $bankdirect = 1;
|
||||
if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly = 1;
|
||||
if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $bankviainvoice = 1;
|
||||
elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) $bankdirect = 1;
|
||||
elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $invoiceonly = 1;
|
||||
|
|
@ -824,8 +721,7 @@ if ($rowid > 0)
|
|||
|
||||
print "\n\n<!-- Form add subscription -->\n";
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
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 '$(document).ready(function () {
|
||||
|
|
@ -861,18 +757,14 @@ if ($rowid > 0)
|
|||
|
||||
|
||||
// Confirm create third party
|
||||
if ($action == 'create_thirdparty')
|
||||
{
|
||||
if ($action == 'create_thirdparty') {
|
||||
$companyalias = '';
|
||||
$fullname = $object->getFullName($langs);
|
||||
|
||||
if ($object->morphy == 'mor')
|
||||
{
|
||||
if ($object->morphy == 'mor') {
|
||||
$companyname = $object->company;
|
||||
if (!empty($fullname)) $companyalias = $fullname;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$companyname = $fullname;
|
||||
if (!empty($object->company)) $companyalias = $object->company;
|
||||
}
|
||||
|
|
@ -883,8 +775,7 @@ if ($rowid > 0)
|
|||
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
|
||||
);
|
||||
// If customer code was forced to "required", we ask it at creation to avoid error later
|
||||
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) {
|
||||
$tmpcompany = new Societe($db);
|
||||
$tmpcompany->name = $companyname;
|
||||
$tmpcompany->get_codeclient($tmpcompany, 0);
|
||||
|
|
@ -922,23 +813,19 @@ if ($rowid > 0)
|
|||
$paymentdate = -1;
|
||||
|
||||
// Date payment
|
||||
if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday'))
|
||||
{
|
||||
if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) {
|
||||
$paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
// Date start subscription
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
||||
if (GETPOST('reday'))
|
||||
{
|
||||
if (GETPOST('reday')) {
|
||||
$datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
}
|
||||
if (!$datefrom)
|
||||
{
|
||||
if (!$datefrom) {
|
||||
$datefrom = $object->datevalid;
|
||||
if ($object->datefin > 0)
|
||||
{
|
||||
if ($object->datefin > 0) {
|
||||
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
|
||||
}
|
||||
}
|
||||
|
|
@ -946,20 +833,17 @@ if ($rowid > 0)
|
|||
print "</td></tr>";
|
||||
|
||||
// Date end subscription
|
||||
if (GETPOST('endday'))
|
||||
{
|
||||
if (GETPOST('endday')) {
|
||||
$dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
}
|
||||
if (!$dateto)
|
||||
{
|
||||
if (!$dateto) {
|
||||
$dateto = -1; // By default, no date is suggested
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
|
||||
print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0);
|
||||
print "</td></tr>";
|
||||
|
||||
if ($adht->subscription)
|
||||
{
|
||||
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>';
|
||||
|
||||
|
|
@ -970,11 +854,9 @@ if ($rowid > 0)
|
|||
print '"></td></tr>';
|
||||
|
||||
// Complementary action
|
||||
if (!empty($conf->banque->enabled) || !empty($conf->facture->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) {
|
||||
$company = new Societe($db);
|
||||
if ($object->fk_soc)
|
||||
{
|
||||
if ($object->fk_soc) {
|
||||
$result = $company->fetch($object->fk_soc);
|
||||
}
|
||||
|
||||
|
|
@ -987,20 +869,17 @@ if ($rowid > 0)
|
|||
print '<td>';
|
||||
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ? ' checked' : '').'> '.$langs->trans("None").'<br>';
|
||||
// Add entry into bank accoun
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ? ' checked' : '');
|
||||
print '> '.$langs->trans("MoreActionBankDirect").'<br>';
|
||||
}
|
||||
// Add invoice with no payments
|
||||
if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled))
|
||||
{
|
||||
if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
|
||||
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ? ' checked' : '');
|
||||
//if (empty($object->fk_soc)) print ' disabled';
|
||||
print '> '.$langs->trans("MoreActionInvoiceOnly");
|
||||
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
|
||||
else
|
||||
{
|
||||
else {
|
||||
print ' (';
|
||||
if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
|
||||
print $langs->trans("NoThirdPartyAssociatedToMember");
|
||||
|
|
@ -1009,8 +888,7 @@ if ($rowid > 0)
|
|||
print '</a>)';
|
||||
}
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled)))
|
||||
{
|
||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
|
||||
$prodtmp = new Product($db);
|
||||
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
||||
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
|
||||
|
|
@ -1018,14 +896,12 @@ if ($rowid > 0)
|
|||
print '<br>';
|
||||
}
|
||||
// Add invoice with payments
|
||||
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
|
||||
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ? ' checked' : '');
|
||||
//if (empty($object->fk_soc)) print ' disabled';
|
||||
print '> '.$langs->trans("MoreActionBankViaInvoice");
|
||||
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
|
||||
else
|
||||
{
|
||||
else {
|
||||
print ' (';
|
||||
if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
|
||||
print $langs->trans("NoThirdPartyAssociatedToMember");
|
||||
|
|
@ -1034,8 +910,7 @@ if ($rowid > 0)
|
|||
print '</a>)';
|
||||
}
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled)))
|
||||
{
|
||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
|
||||
$prodtmp = new Product($db);
|
||||
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
||||
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
|
||||
|
|
@ -1080,12 +955,9 @@ if ($rowid > 0)
|
|||
|
||||
print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>';
|
||||
print '<td>';
|
||||
if (!$object->email)
|
||||
{
|
||||
if (!$object->email) {
|
||||
print $langs->trans("NoEMail");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($object->typeid);
|
||||
|
||||
|
|
@ -1107,8 +979,7 @@ if ($rowid > 0)
|
|||
|
||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
||||
{
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
|
@ -1158,9 +1029,7 @@ if ($rowid > 0)
|
|||
|
||||
//print '</td></tr>';
|
||||
//print '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,41 +66,33 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, n
|
|||
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel)
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel) {
|
||||
// Load current object
|
||||
$result = $object->fetch($rowid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$db->begin();
|
||||
|
||||
$errmsg = '';
|
||||
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
if ($object->fk_bank) {
|
||||
$accountline = new AccountLine($db);
|
||||
$result = $accountline->fetch($object->fk_bank);
|
||||
|
||||
// If transaction consolidated
|
||||
if ($accountline->rappro)
|
||||
{
|
||||
if ($accountline->rappro) {
|
||||
$errmsg = $langs->trans("SubscriptionLinkedToConciliatedTransaction");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$accountline->datev = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||
$accountline->dateo = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||
$accountline->amount = $_POST["amount"];
|
||||
$result = $accountline->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$errmsg = $accountline->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$errmsg)
|
||||
{
|
||||
if (!$errmsg) {
|
||||
// Modify values
|
||||
$object->dateh = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']);
|
||||
$object->datef = dol_mktime($_POST['datesubendhour'], $_POST['datesubendmin'], 0, $_POST['datesubendmonth'], $_POST['datesubendday'], $_POST['datesubendyear']);
|
||||
|
|
@ -110,50 +102,37 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
|
|||
//print 'datef='.$object->datef.' '.$_POST['datesubendday'];
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result >= 0 && !count($object->errors))
|
||||
{
|
||||
if ($result >= 0 && !count($object->errors)) {
|
||||
$db->commit();
|
||||
|
||||
header("Location: card.php?rowid=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($object->error)
|
||||
{
|
||||
if ($object->error) {
|
||||
$errmsg = $object->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($object->errors as $error)
|
||||
{
|
||||
} else {
|
||||
foreach ($object->errors as $error) {
|
||||
if ($errmsg) $errmsg .= '<br>';
|
||||
$errmsg .= $error;
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) {
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$mesg = $adh->error;
|
||||
}
|
||||
}
|
||||
|
|
@ -173,8 +152,7 @@ llxHeader('', $langs->trans("SubscriptionCard"), 'EN:Module_Foundations|FR:Modul
|
|||
dol_htmloutput_errors($errmsg);
|
||||
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
/********************************************
|
||||
*
|
||||
* Subscription card in edit mode
|
||||
|
|
@ -238,19 +216,14 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
|||
print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) {
|
||||
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur" colspan="2">';
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
if ($object->fk_bank) {
|
||||
$bankline = new AccountLine($db);
|
||||
$result = $bankline->fetch($object->fk_bank);
|
||||
print $bankline->getNomUrl(1, 0, 'showall');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $langs->trans("NoneF");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
|
@ -271,8 +244,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
|||
print "\n";
|
||||
}
|
||||
|
||||
if ($rowid && $action != 'edit')
|
||||
{
|
||||
if ($rowid && $action != 'edit') {
|
||||
/********************************************
|
||||
*
|
||||
* Subscription card in view mode
|
||||
|
|
@ -287,8 +259,7 @@ if ($rowid && $action != 'edit')
|
|||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if ($action == 'delete') {
|
||||
//$formquestion=array();
|
||||
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
|
||||
$text = $langs->trans("ConfirmDeleteSubscription");
|
||||
|
|
@ -345,19 +316,14 @@ if ($rowid && $action != 'edit')
|
|||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) {
|
||||
print '<tr><td>'.$langs->trans("BankTransactionLine").'</td><td class="valeur">';
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
if ($object->fk_bank) {
|
||||
$bankline = new AccountLine($db);
|
||||
$result = $bankline->fetch($object->fk_bank);
|
||||
print $bankline->getNomUrl(1, 0, 'showall');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print $langs->trans("NoneF");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
|
@ -377,21 +343,16 @@ if ($rowid && $action != 'edit')
|
|||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if (!$bankline->rappro)
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if (!$bankline->rappro) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=edit\">".$langs->trans("Modify")."</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans("BankLineConciliated")."\" href=\"#\">".$langs->trans("Modify")."</a></div>";
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id."&action=delete\">".$langs->trans("Delete")."</a></div>\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,15 +110,13 @@ $parameters = array('socid'=>$socid);
|
|||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_type = "";
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$search_type = "";
|
||||
$search_ref = "";
|
||||
$search_lastname = "";
|
||||
$search_firstname = "";
|
||||
|
|
@ -153,13 +151,11 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription a
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
|
||||
$sql .= " WHERE d.rowid = c.fk_adherent";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if (isset($date_select) && $date_select != '')
|
||||
{
|
||||
if (isset($date_select) && $date_select != '') {
|
||||
$sql .= " AND c.dateadh >= '".$date_select."-01-01 00:00:00'";
|
||||
$sql .= " AND c.dateadh < '".($date_select + 1)."-01-01 00:00:00'";
|
||||
}
|
||||
if ($search_ref)
|
||||
{
|
||||
if ($search_ref) {
|
||||
if (is_numeric($search_ref)) $sql .= " AND (c.rowid = ".$db->escape($search_ref).")";
|
||||
else $sql .= " AND 1 = 2"; // Always wrong
|
||||
}
|
||||
|
|
@ -183,14 +179,12 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) $nbtotalofrecords = $db->num_rows($resql);
|
||||
else dol_print_error($db);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -198,8 +192,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -208,8 +201,7 @@ $num = $db->num_rows($result);
|
|||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||
{
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id);
|
||||
|
|
@ -247,8 +239,7 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions =
|
|||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
|
||||
}
|
||||
|
||||
|
|
@ -269,8 +260,7 @@ $objecttmp = new Subscription($db);
|
|||
$trackid = 'sub'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
if ($sall) {
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
|
@ -289,70 +279,59 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
|||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Line numbering
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
}
|
||||
|
||||
// Type
|
||||
if (!empty($arrayfields['d.fk_type']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.fk_type']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
|
||||
print'</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['c.dateadh']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.dateadh']['checked'])) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['c.datef']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datef']['checked'])) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['d.amount']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.amount']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
|
||||
print '</td>';
|
||||
|
|
@ -365,14 +344,12 @@ $parameters = array('arrayfields'=>$arrayfields);
|
|||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -412,8 +389,7 @@ print "</tr>\n";
|
|||
|
||||
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$subscription->ref = $obj->crowid;
|
||||
|
|
@ -435,17 +411,14 @@ while ($i < min($num, $limit))
|
|||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print '<td>'.$subscription->getNomUrl(1).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type
|
||||
if (!empty($arrayfields['d.fk_type']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.fk_type']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($typeid > 0)
|
||||
{
|
||||
if ($typeid > 0) {
|
||||
print $adht->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -453,30 +426,26 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
|
||||
// Lastname
|
||||
if (!empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
$adherent->firstname = '';
|
||||
print '<td>'.$adherent->getNomUrl(-1).'</td>';
|
||||
$adherent->firstname = $obj->firstname;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Login
|
||||
if (!empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (!empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '<td>';
|
||||
print dol_trunc($obj->note, 128);
|
||||
print '</td>';
|
||||
|
|
@ -484,11 +453,9 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
|
||||
// Banque
|
||||
if (!empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
print '<td class="tdmaxoverflow150">';
|
||||
if ($obj->fk_account > 0)
|
||||
{
|
||||
if ($obj->fk_account > 0) {
|
||||
$accountstatic->id = $obj->fk_account;
|
||||
$accountstatic->fetch($obj->fk_account);
|
||||
//$accountstatic->label=$obj->label;
|
||||
|
|
@ -499,20 +466,17 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
|
||||
// Date start
|
||||
if (!empty($arrayfields['c.dateadh']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.dateadh']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date end
|
||||
if (!empty($arrayfields['c.datef']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datef']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Price
|
||||
if (!empty($arrayfields['d.amount']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['d.amount']['checked'])) {
|
||||
print '<td class="right">'.price($obj->subscription).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
|
||||
|
|
@ -521,20 +485,18 @@ while ($i < min($num, $limit))
|
|||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
|
|
@ -542,8 +504,7 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
// Action column
|
||||
print '<td class="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
|
|
@ -560,8 +521,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
|
@ -33,8 +32,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
|||
$langs->load("members");
|
||||
|
||||
$total = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
echo '<tr class="oddeven">';
|
||||
echo '<td>'.$langs->trans("Subscription").'</td>';
|
||||
echo '<td>'.$objectlink->getNomUrl(1).'</td>';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user