Merge branch 'develop' into patch-34
This commit is contained in:
commit
1008c0a6f6
327
ChangeLog
327
ChangeLog
@ -2,39 +2,267 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 6.0.4 compared to 6.0.3 *****
|
||||
FIX: #7737
|
||||
FIX: #7751
|
||||
FIX: #7756 Add better error message
|
||||
FIX: #7786
|
||||
FIX: #7806
|
||||
FIX: #7824
|
||||
FIX: add line bad price and ref
|
||||
FIX: A lot of several fix on local taxes and NPR tax
|
||||
FIX: createfromorder
|
||||
FIX: CSS for IE10
|
||||
FIX: external user cannot be set as internal
|
||||
FIX: Filter type on actioncomm with multiselect doesn't work
|
||||
FIX: list of donation not filtered on multicompany
|
||||
FIX: list of module not complete when module mb_strlen not available
|
||||
FIX: Locatax were not propagated when cloning order or proposal
|
||||
FIX: Searching translation should not be case sensitive
|
||||
FIX: Search into language is ok for file into external modules two.
|
||||
FIX: test for filter fk_status
|
||||
FIX: too much users on holiday list
|
||||
FIX: Wrong alias sql
|
||||
|
||||
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
|
||||
'doaction' into 'sendMail'.
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
|
||||
For users:
|
||||
NEW: When payment is registered, PDF of invoices are also regenerated so payments
|
||||
appears with no need to click on regenerate.
|
||||
NEW: #5711 Add shipment line deleting and editing for draft shipments.
|
||||
NEW: Accept substitution key __[ABC]__ replaced with value of const ABC
|
||||
NEW: Accountancy Add variant on sell account for intracommunity sales & export sales
|
||||
NEW: Add a button "Activate all services" on contracts
|
||||
NEW: Add a confirmation for all mass action 'delete'
|
||||
NEW: Add a group task line for tasks on same level on gantt diagram
|
||||
NEW: Add and edit country for chart of accounts systems
|
||||
NEW: add a new notification for the signed closed event of a proposal.
|
||||
NEW: Add a parameter to specify char used as separator for variant product label
|
||||
NEW: Add a profile to import product translations
|
||||
NEW: Add a protection so we can't journalize non balanced transactions
|
||||
NEW: Add a status enabled/disabled on recurring invoices
|
||||
NEW: add burger menu to list action comm
|
||||
NEW: Add button cancel on shipment creation
|
||||
NEW: Add chart of account for england
|
||||
NEW: Add Chile accounting plan
|
||||
NEW: Add class in societe/card.php
|
||||
NEW: add company alias name when create company from member
|
||||
NEW: Add date of birth on user card.
|
||||
NEW: Add date_valid and date_pointoftax on supplier invoices.
|
||||
NEW: Added Region name to state/province form field
|
||||
NEW: Added regions to third party/societe lists, can be filtered
|
||||
NEW: Add error message
|
||||
NEW: Add expense report rules and ik
|
||||
NEW: Add filter on event code on automatic filling setup page
|
||||
NEW: Add filters on month/year on the accountancy binding tools
|
||||
NEW: add fk_unit field into product/service import/export
|
||||
NEW: add 'formObjectOptions' hook to the form setting the product selling price
|
||||
NEW: Add hidden option PROJECT_DISABLE_UNLINK_FROM_OVERVIEW
|
||||
NEW: add image object_phoning_mobile.png
|
||||
NEW: Adding Field "First date of expire" + filter on contract list
|
||||
NEW: add ldap_rename for avoid password if ldap key changed
|
||||
NEW: Add mass action "validate" on supplier invoices.
|
||||
NEW: add members types ldap group management
|
||||
NEW: Add new property visible dy default on lists on extrafields
|
||||
NEW: Add Next/Previous button on operation date of bank line
|
||||
NEW: Add option EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS
|
||||
NEW: Add option PROPOSAL/ORDER/INVOICE_ALLOW_EXTERNAL_DOWNLOAD
|
||||
NEW: Add product unit fields for ODT substitution
|
||||
NEW: Add project on a various payment
|
||||
NEW: Add project related fields to ODT
|
||||
NEW: Add protection to avoid to send to much emails using builk actions
|
||||
NEW: Add search field for date on supplier payment page
|
||||
NEW: Add search on date and accounting account in various payment list
|
||||
NEW: add specific translation for title of documents (Invoice, Order, Proposal)
|
||||
NEW: Adds the payment reference to the return of the function getListOfPayements
|
||||
NEW: Add supplier proposals into stats of product page.
|
||||
NEW: Add tab "Expense report" on user card
|
||||
NEW: add the ability to regenerate a pdf for the order module
|
||||
NEW: Add The accountancy Switzerland chart of accounts
|
||||
NEW: Add The developed French chart of accounts 2014
|
||||
NEW: Add The Luxembourg chart of accounts
|
||||
NEW: Add The Moroccan chart of accounts
|
||||
NEW: Add The Switzerland chart of accounts
|
||||
NEW: Add The SYSCOHADA chart of accounts
|
||||
NEW: Add the total in the perday view of the time spent form.
|
||||
NEW: Add The Tunisia chart of accounts
|
||||
NEW: Add toolkit for StockLimit and DesiredStock
|
||||
NEW: add translation and possibility to change month and year
|
||||
NEW: Add view of status of template invoice
|
||||
NEW: All search boxes are available on smartphone
|
||||
NEW: All setup of accountancy can be done from menu "Accountancy-Setup"
|
||||
NEW: Attaching doc automatically in email is now a parameter of template.
|
||||
NEW: automatic activation of external module on country set
|
||||
NEW: Better autoselect customer or supplier fields to save clicks
|
||||
NEW: Better behaviour when using a text browser
|
||||
NEW: Break lines per project on the new timesheet page
|
||||
NEW: Bulk action validate on customer invoices
|
||||
NEW: Bulk delete actions available on leave requests
|
||||
NEW: burger menu and hooks on list action
|
||||
NEW: Can add html content on right of tabs
|
||||
NEW: Can add link to other element on a donation
|
||||
NEW: Can create intervention from a proposal
|
||||
NEW: Can create thirdparty from card proposal, order or invoice
|
||||
NEW: Can download PDF document from the payment page
|
||||
NEW: Can edit the language into the email templates editor.
|
||||
NEW: Can edit with delete/insert a forced translation
|
||||
NEW: Can export list of stock movements
|
||||
NEW: Can filter on date on the page showing existing bindings
|
||||
NEW: Can filter on document name in ECM module for automatic tree
|
||||
NEW: can filter on status of template invoices
|
||||
NEW: Can filter on the "other" column on emailing target list
|
||||
NEW: Can filter on type of email template
|
||||
NEW: Can filter on user on unalterable log
|
||||
NEW: Can import local tax rates in prices
|
||||
NEW: Can include extrafields into member card templates
|
||||
NEW: Can include tag {uuu} into some numbering masks to replace with user
|
||||
NEW: Can make a specific setup for SMTP sending for emailing module
|
||||
NEW: Can rename (so reorder) bank receipts
|
||||
NEW: Can send email from contract card
|
||||
NEW: Can send email from the member card using email templates.
|
||||
NEW: Can set a dedicated message on payment forms
|
||||
NEW: Can set email of thirdparty as unique and/or mandatory
|
||||
NEW: Can setup csv accounting export from admin config
|
||||
NEW: Can show currency in list of bank accounts
|
||||
NEW: Can show stock in alert even if alter is set to 0
|
||||
NEW: Can sort joined files on thirdparty and user card.
|
||||
NEW: Can transfer from bank account to bank account with different currencies
|
||||
NEW: Can use an url like $conf->global>-MYPARAM for menu urls
|
||||
NEW: change description on click
|
||||
NEW: Chart of account is loaded when selected into accounting setup
|
||||
NEW: Classify the order as invoiced in the REST API
|
||||
NEW: comments system on task
|
||||
NEW: comment system working with all objects
|
||||
NEW: Compatibility with PHP 7.2
|
||||
NEW: confirm form style to accept or reject proposal
|
||||
NEW: Create an invoice using an existing order
|
||||
NEW: Create an order using an existing proposal
|
||||
NEW: customizable meteo in value or percentage
|
||||
NEW: Days where user is on vacation use different colors in timesheet.
|
||||
NEW: Deduct an available credit to an existing invoice
|
||||
NEW: Default filter and sort order can use partial list of query
|
||||
NEW: Deposit invoice more explicit in invoice line description
|
||||
NEW: deposits can be converted even if unpaid
|
||||
NEW: detection of edge browser
|
||||
NEW: Each user can edit its own email template (menu tools)
|
||||
NEW: Enabled sending email in bulk actions for supplier orders
|
||||
NEW: Enhance the anti XSS filter
|
||||
NEW: extrafield on facture_rec
|
||||
NEW: Extrafields "link to object" now use a combo selection and getNomUrl
|
||||
NEW: filter date for blockedlog
|
||||
NEW: filter on extrafield on product list (as in company list)
|
||||
NEW: General ledger : Add field date_creation and selected field
|
||||
NEW: generate also document when invoice is build from recurring template
|
||||
NEW: Generated files are now indexed in database
|
||||
NEW: generate invoice PDF on disount application or payment
|
||||
NEW: Get a list of payments terms
|
||||
NEW: hrm details output on user
|
||||
NEW: If max nb of generation is reached, date for next gen is striked
|
||||
NEW: improvements of invoices, orders and proposals in the REST API
|
||||
NEW: Include a color syntaxed HTML editor for emailing edition.
|
||||
NEW: Introduce code syntax coloration with mode 'ace' for DolEditor.
|
||||
NEW: Introduce experimental feature to search dolistore from application
|
||||
NEW: jquery date selector become default date selector
|
||||
NEW: langs
|
||||
NEW: link project from other company conf
|
||||
NEW: manageme extrafields with multientity
|
||||
NEW: Mass PDF Merging is available on contracts
|
||||
NEW: merge categories while merging thirdparties
|
||||
NEW: Merge resource/add.php to resource/card.php
|
||||
NEW: Module "Product variants" is moved as stable.
|
||||
NEW: More picto for phone
|
||||
NEW: Move accountancy features into a dedicated menu
|
||||
NEW: Move contacts of a thirdparty on tab Contacts/Addresses
|
||||
NEW: Move the upload input on top right in ECM module
|
||||
NEW: new columns into extrafields table to get update create information
|
||||
NEW: new param on load_board() function in ActionComm class to avoid duplicate code
|
||||
NEW: On bulk email from a list, can uncheck "Join main document".
|
||||
NEW: On reconciliation, show balance including all reconciliated fields
|
||||
NEW: Option "one email per recipient" when using bulk actions emails.
|
||||
NEW: Option STOCK_SUPPORTS_SERVICES become visible.
|
||||
NEW: option to avoid countries to disable there blockedlog
|
||||
NEW: option to fix top menu with eldy theme (hidden conf)
|
||||
NEW: Popup for preview of image add a button "Original size"
|
||||
NEW: post lines of an invoice using the REST API
|
||||
NEW: preload comments in task
|
||||
NEW: Provide a way to download a file from a public URL for files in ECM
|
||||
NEW: Reduce size of HTML page by removing duplicate tooltips
|
||||
NEW: Remove background on agenda view when event is a not busy event.
|
||||
NEW: Retrieves available discounts and payments details from a specific invoice
|
||||
NEW: Revenue stamp can be a percent
|
||||
NEW: Search filters in lists are restored when using "back to list"
|
||||
NEW: Send by email available in bulk for expense report
|
||||
NEW: Set a proposal to draft
|
||||
NEW: Show badge with nbr of shipment on shimpen tab of order
|
||||
NEW: Show country and vat number into company tooltip
|
||||
NEW: Show direct preview link on contract
|
||||
NEW: Show expected worked hours on the timesheet form.
|
||||
NEW: Show line "other filtered task" when using filter on timesheet.
|
||||
NEW: Show list of tracked events into the module config page.
|
||||
NEW: Show the supplier ref into supplier cards
|
||||
NEW: Show user id of web process in system info - web server
|
||||
NEW: Summary of last events on a card are sorted on decreasing date.
|
||||
NEW: Support Italian addresses format. Fixes #7785
|
||||
NEW: Support visibility on extrafields
|
||||
NEW: Template invoices are visible on the customer tab
|
||||
NEW: template invoices support substition key
|
||||
NEW: The bank account is visible on payment of taxes
|
||||
NEW: The comment when closing a proposal is added to commercial proposal
|
||||
NEW: The gantt diagram is now sensitive to hours
|
||||
NEW: The lot of a product uses the link and picto when shown into list.
|
||||
NEW: The "Show detail by account" accepts 3 values: yes, no, if non zero
|
||||
NEW: The unalterable log can be browse by any user with he permission
|
||||
NEW: Tooltip for substitutions variables on tooltips on admin pages
|
||||
NEW: unexistant function load_state_board() on several objects
|
||||
NEW: Update availability
|
||||
NEW: Update bank account when updating an invoice
|
||||
NEW: Update bank account when updating an order
|
||||
NEW: Use autocompletion on selection of chart of account
|
||||
NEW: view company name if different of fullname in dol_banner
|
||||
NEW: warning on module blocked log reset if country code is FR
|
||||
|
||||
For developers:
|
||||
NEW: Add 2 new automatic classification in workflow module
|
||||
NEW: Add API for contracts
|
||||
NEW: Add API to activate/unactivate a contract
|
||||
NEW: Add api validate and close on contracts
|
||||
NEW: add doActions hook in admin ihm
|
||||
NEW: add doActions hook in company admin
|
||||
NEW: Added functionality to get order customer contact as contact_xx tags
|
||||
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||
NEW: Add method executeCLI and a phpunit
|
||||
NEW: add '$moreatt' parameter in picto_from_langcode function
|
||||
NEW: Add non intrusive js library to make syntaxic coloring of textarea
|
||||
NEW: Add payment line to a specific invoice using the REST API
|
||||
NEW: add possibility to disabled the LDAP trigger
|
||||
NEW: add possibility to hide LDAP tab for non admin
|
||||
NEW: Add possibility to propose last num releve in conciliation
|
||||
NEW: add possibility to remove address field
|
||||
NEW: Add REST API for supplier proposals
|
||||
NEW: Add REST API to add payment line to a specific invoice
|
||||
NEW: Add the attribute accept to the input form for file upload
|
||||
NEW: add translation column for extrafields list
|
||||
NEW: Add performances indexes on calendar events
|
||||
NEW: A module can change order of element in the quick search combo
|
||||
NEW: Can test signature of a version from API
|
||||
NEW: complete_head_from_modules() in ldap_prepare_head()
|
||||
NEW: Consolidates REST dictionary APIs into a single tree and a single file
|
||||
NEW: Delete a line of invoice using the REST API
|
||||
NEW: documents REST API return list of documents by element
|
||||
NEW: Download a document using the REST API
|
||||
NEW: Enhance framework so we can use html/icons into SELECT options.
|
||||
NEW: External module can interact with the customer summary page
|
||||
NEW: Generates the document before downloading using REST API
|
||||
NEW: get and post lines of an invoice using the REST API
|
||||
NEW: Get a payment list of a given invoice using the REST API
|
||||
NEW: Get available assets of an invoice using the REST API
|
||||
NEW: Get credit notes or deposits of a thirdparty
|
||||
NEW: GET lines of an invoice in the REST API
|
||||
NEW: get payment types using the REST API + consolidates REST dictionary APIs
|
||||
NEW: Get the list of payments terms.
|
||||
NEW: hook formObjectOptions in the form setting product selling price
|
||||
NEW: hook to enrich homepage open elements dashboard
|
||||
NEW: Insert a discount in a specific invoice using the REST API
|
||||
NEW: Remove js library fileupload that was not used by core code.
|
||||
NEW: Remove tooltip tipTip library replaced with standatd jquery tooltip
|
||||
NEW: Set invoices as draft using the REST API
|
||||
NEW: Sets an invoice as paid using the REST API
|
||||
NEW: Tag the order as validated (opened) in the REST API
|
||||
NEW: Update end of validity date of proposal using the API
|
||||
NEW: Update in the order REST API
|
||||
NEW: Upgrade jquery select2 to 4.0.4
|
||||
|
||||
WARNING:
|
||||
|
||||
If you enabled (for test) the experimental BlockedLog module before 7.0, you must purge the table llx_blockedlog because
|
||||
WARNING:
|
||||
|
||||
If you enabled (for test) the experimental BlockedLog module before 7.0, you must purge the table llx_blockedlog because
|
||||
way to save data for final version has changed.
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
@ -60,6 +288,57 @@ Following changes may create regressions for some external modules, but were nec
|
||||
and add 'td.' to the beginning of the dragHandle match string.
|
||||
* IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported.
|
||||
|
||||
* If you use the external module "multicompany", you must also upgrade the module. Multicompany module for
|
||||
Dolibarr v7 is required because with Dolibarr v7, payment modes and payment conditions are management as data
|
||||
that are dedicated to each company. If you keep your old version of multicompany module, mode and
|
||||
condition of payments will appears empty in all companies that are not the first one. By upgrading the
|
||||
multicompany module to a version that support Dolibarr v7, everything should work as expected.
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.5 compared to 6.0.4 *****
|
||||
FIX: security vulnerability reported by ADLab of Venustech
|
||||
CVE-2017-17897, CVE-2017-17898, CVE-2017-17899, CVE-2017-17900
|
||||
FIX: #7379: Compatibility with PRODUCT_USE_OLD_PATH_FOR_PHOTO variable
|
||||
FIX: #7903
|
||||
FIX: #7933
|
||||
FIX: #8029 Unable to make leave request in holyday module
|
||||
FIX: #8093
|
||||
FIX: Bad name alias showing in name of third column
|
||||
FIX: Cashdesk should not sell to inactive third parties
|
||||
FIX: Edit accountancy account and warning message on loan
|
||||
FIX: $accounts[$bid] is a label !
|
||||
FIX: $oldvatrateclean & $newvatrateclean must be set if preg_match === false
|
||||
FIX: product best price on product list
|
||||
FIX: search on contact list
|
||||
FIX: stats trad for customerinvoice
|
||||
FIX: translate unactivate on contractline
|
||||
FIX: email sent was not in HTML
|
||||
FIX: missing hook invoice index
|
||||
FIX: subject mail sepa
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.4 compared to 6.0.3 *****
|
||||
FIX: #7737
|
||||
FIX: #7751
|
||||
FIX: #7756 Add better error message
|
||||
FIX: #7786
|
||||
FIX: #7806
|
||||
FIX: #7824
|
||||
FIX: add line bad price and ref
|
||||
FIX: A lot of several fix on local taxes and NPR tax
|
||||
FIX: createfromorder
|
||||
FIX: CSS for IE10
|
||||
FIX: external user cannot be set as internal
|
||||
FIX: Filter type on actioncomm with multiselect doesn't work
|
||||
FIX: list of donation not filtered on multicompany
|
||||
FIX: list of module not complete when module mb_strlen not available
|
||||
FIX: Locatax were not propagated when cloning order or proposal
|
||||
FIX: Searching translation should not be case sensitive
|
||||
FIX: Search into language is ok for file into external modules two.
|
||||
FIX: test for filter fk_status
|
||||
FIX: too much users on holiday list
|
||||
FIX: Wrong alias sql
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||
FIX: #7211 Update qty dispatched on qty change
|
||||
|
||||
@ -442,7 +442,7 @@ SORT_BY_SCOPE_NAME = NO
|
||||
# disable (NO) the todo list. This list is created by putting \todo
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TODOLIST = NO
|
||||
|
||||
# The GENERATE_TESTLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the test list. This list is created by putting \test
|
||||
@ -639,7 +639,7 @@ EXCLUDE_SYMBOLS =
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH = ../../dev/skeletons
|
||||
EXAMPLE_PATH = ../../htdocs/modulebuilder/template
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
|
||||
@ -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="ldestailleur\@vmprod.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
||||
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
||||
|
||||
|
||||
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"agenda"
|
||||
],
|
||||
"homepage": "https://www.dolibarr.org",
|
||||
"license": "GPL-3.0+",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dolibarr/dolibarr/issues",
|
||||
"forum": "https://www.dolibarr.org/forum",
|
||||
|
||||
2
dev/initdemo/documents_demo/medias/README.txt
Normal file
2
dev/initdemo/documents_demo/medias/README.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# File(s) into root medias directory are provide by Pixabay with Licence "CC0 Creative Commons"
|
||||
# https://creativecommons.org/publicdomain/zero/1.0/
|
||||
BIN
dev/initdemo/documents_demo/medias/background_sunset.jpg
Normal file
BIN
dev/initdemo/documents_demo/medias/background_sunset.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
9871
dev/initdemo/mysqldump_dolibarr_7.0.0.sql
Normal file
9871
dev/initdemo/mysqldump_dolibarr_7.0.0.sql
Normal file
File diff suppressed because one or more lines are too long
@ -39,6 +39,7 @@ $mesg = '';
|
||||
$action = GETPOST('action','aZ09');
|
||||
$backtopage = GETPOST('backtopage','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
|
||||
@ -261,8 +262,10 @@ if ($action == 'create') {
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
} else if ($id) {
|
||||
$result = $object->fetch($id);
|
||||
}
|
||||
else if ($id > 0 || $ref) {
|
||||
|
||||
$result = $object->fetch($id, $ref, 1);
|
||||
|
||||
if ($result > 0) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
@ -329,17 +332,18 @@ if ($action == 'create') {
|
||||
// View mode
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'billr');
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'account_number', 'ref');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Account number
|
||||
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td>' . $object->account_number . '</td>';
|
||||
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
|
||||
print '<td colspan="2">' . $object->label . '</td></tr>';
|
||||
|
||||
// Account parent
|
||||
@ -361,20 +365,10 @@ if ($action == 'create') {
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
||||
|
||||
// Active
|
||||
print '<tr><td>' . $langs->trans("Status") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $object->getLibStatut(4);
|
||||
/*if (empty($object->active)) {
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
} else {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}*/
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
@ -397,7 +391,7 @@ if ($action == 'create') {
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -136,17 +136,25 @@ if ($action == 'update') {
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||
$arrayofdifferentselectedvalues = array();
|
||||
|
||||
$cpt = 0; $ok = 0; $ko = 0;
|
||||
foreach ( $chk_prod as $productid ) {
|
||||
|
||||
foreach ( $chk_prod as $productid )
|
||||
{
|
||||
$accounting_account_id = GETPOST('codeventil_' . $productid);
|
||||
|
||||
$result = $accounting->fetch($accounting_account_id, null, 1);
|
||||
if ($result < 0) {
|
||||
$result = 0;
|
||||
if ($accounting_account_id > 0)
|
||||
{
|
||||
$arrayofdifferentselectedvalues[$accounting_account_id]=$accounting_account_id;
|
||||
$result = $accounting->fetch($accounting_account_id, null, 1);
|
||||
}
|
||||
if ($result <= 0) {
|
||||
// setEventMessages(null, $accounting->errors, 'errors');
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$db->begin();
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
@ -158,23 +166,23 @@ if ($action == 'update') {
|
||||
$sql .= " WHERE rowid = " . $productid;
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$ok++;
|
||||
//$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '</font></div>';
|
||||
$db->commit();
|
||||
} else {
|
||||
$ko++;
|
||||
//$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
$cpt ++;
|
||||
$cpt++;
|
||||
}
|
||||
} else {
|
||||
//$msg .= '<div><span class="accountingprocessing">' . $langs->trans("AnyLineVentilate") . '</span></div>';
|
||||
|
||||
}
|
||||
|
||||
if ($ko) setEventMessages($langs->trans("XLineFailedToBeBinded", $ko), null, 'errors');
|
||||
if ($ok) setEventMessages($langs->trans("XLineSuccessfullyBinded", $ok), null, 'mesgs');
|
||||
//$msg .= '<div><span class="accountingprocessing">' . $langs->trans("EndProcessing") . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ if (GETPOST("exportcsv")) $action = 'export_csv';
|
||||
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
|
||||
$offset = $limit * $page;
|
||||
|
||||
@ -68,17 +69,27 @@ $form = new Form($db);
|
||||
|
||||
if (empty($search_date_start) && ! GETPOSTISSET('formfilteraction'))
|
||||
{
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
$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())."'";
|
||||
$sql.= $db->plimit(1);
|
||||
$res = $db->query($sql);
|
||||
if ($res->num_rows > 0) {
|
||||
$fiscalYear = $db->fetch_object($res);
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
|
||||
@ -648,7 +648,10 @@ if ($action == 'create')
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if (price2num($total_debit) != price2num($total_credit))
|
||||
$total_debit = price2num($total_debit);
|
||||
$total_credit = price2num($total_credit);
|
||||
|
||||
if ($total_debit != $total_credit)
|
||||
{
|
||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
||||
}
|
||||
|
||||
@ -35,9 +35,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
|
||||
$page = GETPOST("page");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$search_mvt_num = GETPOST('search_mvt_num', 'int');
|
||||
$search_doc_type = GETPOST("search_doc_type");
|
||||
@ -49,7 +46,7 @@ $search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmo
|
||||
$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
|
||||
$search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int'));
|
||||
$search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
|
||||
|
||||
//var_dump($search_date_start);exit;
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||
$action = 'delbookkeepingyear';
|
||||
}
|
||||
@ -90,7 +87,7 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "t.rowid";
|
||||
if ($sortfield == "") $sortfield = "t.piece_num,t.rowid";
|
||||
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
@ -99,26 +96,40 @@ $formaccounting = new FormAccounting($db);
|
||||
$formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page) && ! GETPOST('noreset','int'))
|
||||
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int'))
|
||||
{
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
if (empty($search_date_start) && empty($search_date_end))
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||
$res = $db->query($query);
|
||||
|
||||
if ($res->num_rows > 0) {
|
||||
$fiscalYear = $db->fetch_object($res);
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$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
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
|
||||
|
||||
$arrayfields=array(
|
||||
'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("Docref"), 'checked'=>1),
|
||||
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
|
||||
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
|
||||
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
||||
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
@ -424,7 +435,7 @@ else $button.= $langs->trans("ExportList");
|
||||
$button.= '</a>';
|
||||
|
||||
|
||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param.'">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$addbutton, '', $limit);
|
||||
@ -570,17 +581,17 @@ print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
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_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $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.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $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, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -671,14 +682,14 @@ if ($num > 0)
|
||||
// Creation operation date
|
||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->date_creation, 'day') . '</td>';
|
||||
print '<td align="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Modification operation date
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->date_modification, 'day') . '</td>';
|
||||
print '<td align="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -698,6 +709,7 @@ if ($num > 0)
|
||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||
{
|
||||
$i=0;
|
||||
print '<tr class="liste_total">';
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
|
||||
@ -40,34 +40,18 @@ $page = GETPOST("page");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
if (empty($search_date_start))
|
||||
{
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
|
||||
$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(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||
|
||||
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
}
|
||||
$search_label_account = GETPOST('search_label_account', 'alpha');
|
||||
|
||||
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
|
||||
$search_direction = GETPOST('search_direction', 'alpha');
|
||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||
@ -77,15 +61,38 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0) { $page = 0; }
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "t.rowid";
|
||||
|
||||
if (empty($search_date_start)) $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
if (empty($search_date_start) && empty($search_date_end)) {
|
||||
$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())."'";
|
||||
$sql.= $db->plimit(1);
|
||||
$res = $db->query($sql);
|
||||
|
||||
if ($res->num_rows > 0) {
|
||||
$fiscalYear = $db->fetch_object($res);
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$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
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
}
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
@ -95,39 +102,38 @@ $filter = array ();
|
||||
|
||||
if (! empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
}
|
||||
if (! empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
||||
}
|
||||
if (! empty($search_doc_date)) {
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
||||
$options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
||||
}
|
||||
|
||||
|
||||
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 (! empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
||||
$options .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
||||
$options .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
|
||||
}
|
||||
if (! empty($search_label_account)) {
|
||||
$filter['t.label_operation'] = $search_label_account;
|
||||
$options .= '&search_label_account=' . $search_label_account;
|
||||
$options .= '&search_label_account=' . urlencode($search_label_account);
|
||||
}
|
||||
if (! empty($search_mvt_label)) {
|
||||
$filter['t.label_operation'] = $search_mvt_label;
|
||||
$options .= '&search_mvt_label=' . $search_mvt_label;
|
||||
$options .= '&search_mvt_label=' . urlencode($search_mvt_label);
|
||||
}
|
||||
if (! empty($search_direction)) {
|
||||
$filter['t.sens'] = $search_direction;
|
||||
$options .= '&search_direction=' . $search_direction;
|
||||
$options .= '&search_direction=' . urlencode($search_direction);
|
||||
}
|
||||
if (! empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
$options .= '&search_ledger_code=' . $search_ledger_code;
|
||||
$options .= '&search_ledger_code=' . urlencode($search_ledger_code);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,6 +180,7 @@ $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By"
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
@ -184,6 +191,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -218,14 +226,17 @@ if ($action == 'delbookkeepingyear') {
|
||||
}
|
||||
|
||||
|
||||
|
||||
$param=$options;
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param.'">' . $langs->trans("ViewFlatList") . '</a>';
|
||||
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat.$addbutton,'', $limit);
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$addbutton, '', $limit);
|
||||
|
||||
// Reverse sort order
|
||||
if ( preg_match('/^asc/i', $sortorder) )
|
||||
|
||||
@ -1,295 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/listbyyear.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Book keeping by year
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
|
||||
$page = GETPOST("page");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$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(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$search_doc_type = GETPOST('search_doc_type', 'alpha');
|
||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
|
||||
$search_numero_compte = GETPOST('search_numero_compte', 'alpha');
|
||||
$search_numero_compte_start = GETPOST('search_numero_compte_start', 'alpha');
|
||||
if ($search_numero_compte_start == - 1) {
|
||||
$search_numero_compte_start = '';
|
||||
}
|
||||
$search_numero_compte_end = GETPOST('search_numero_compte_end', 'alpha');
|
||||
if ($search_numero_compte_end == - 1) {
|
||||
$search_numero_compte_end = '';
|
||||
}
|
||||
$search_subledger_account = GETPOST('search_subledger_account', 'alpha');
|
||||
$search_subledger_account_start = GETPOST('search_subledger_account_start', 'alpha');
|
||||
if ($search_subledger_account_start == - 1) {
|
||||
$search_subledger_account_start = '';
|
||||
}
|
||||
$search_subledger_account_end = GETPOST('search_subledger_account_end', 'alpha');
|
||||
if ($search_subledger_account_end == - 1) {
|
||||
$search_subledger_account_end = '';
|
||||
}
|
||||
$search_label_operation = GETPOST('search_label_operation', 'alpha');
|
||||
$search_sens = GETPOST('search_sens', 'alpha');
|
||||
$search_code_journal = GETPOST('search_code_journal', 'alpha');
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
$form = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
// Filter
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "t.rowid";
|
||||
|
||||
$offset = $limit * $page;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
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_type = "";
|
||||
$search_doc_date = "";
|
||||
$search_doc_ref = "";
|
||||
$search_numero_compte = "";
|
||||
$search_subledger_account = "";
|
||||
$search_label_operation = "";
|
||||
$search_sens = "";
|
||||
$search_code_journal = "";
|
||||
}
|
||||
|
||||
$options = '';
|
||||
$filter = array ();
|
||||
if (! empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
}
|
||||
if (! empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
||||
}
|
||||
if (! empty($search_doc_type)) {
|
||||
$filter['t.doc_type'] = $search_doc_type;
|
||||
$options .= '&search_doc_type=' . $search_doc_type;
|
||||
}
|
||||
if (! empty($search_doc_date)) {
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
||||
}
|
||||
if (! empty($search_doc_ref)) {
|
||||
$filter['t.doc_ref'] = $search_doc_ref;
|
||||
$options .= '&search_doc_ref=' . $search_doc_ref;
|
||||
}
|
||||
if (! empty($search_numero_compte)) {
|
||||
$filter['t.numero_compte'] = $search_numero_compte;
|
||||
$options .= '&search_numero_compte=' . $search_numero_compte;
|
||||
}
|
||||
if (! empty($search_numero_compte_start)) {
|
||||
$filter['t.numero_compte>='] = $search_numero_compte_start;
|
||||
$options .= '&search_numero_compte_start=' . $search_numero_compte_start;
|
||||
}
|
||||
if (! empty($search_numero_compte_end)) {
|
||||
$filter['t.numero_compte<='] = $search_numero_compte_end;
|
||||
$options .= '&search_numero_compte_end=' . $search_numero_compte_end;
|
||||
}
|
||||
if (! empty($search_subledger_account)) {
|
||||
$filter['t.subledger_account'] = $search_subledger_account;
|
||||
$options .= '&search_subledger_account=' . $search_subledger_account;
|
||||
}
|
||||
if (! empty($search_subledger_account_start)) {
|
||||
$filter['t.subledger_account>='] = $search_subledger_account_start;
|
||||
$options .= '&search_subledger_account_start=' . $search_subledger_account_start;
|
||||
}
|
||||
if (! empty($search_subledger_account_end)) {
|
||||
$filter['t.subledger_account<='] = $search_subledger_account_end;
|
||||
$options .= '&search_subledger_account_end=' . $search_subledger_account_end;
|
||||
}
|
||||
if (! empty($search_label_operation)) {
|
||||
$filter['t.label_operation'] = $search_label_operation;
|
||||
$options .= '&search_label_operation=' . $search_label_operation;
|
||||
}
|
||||
if (! empty($search_sens)) {
|
||||
$filter['t.sens'] = $search_sens;
|
||||
$options .= '&search_sens=' . $search_sens;
|
||||
}
|
||||
if (! empty($search_code_journal)) {
|
||||
$filter['t.code_journal'] = $search_code_journal;
|
||||
$options .= '&search_code_journal=' . $search_code_journal;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Bookkeeping"));
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy');
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('DateStart') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start');
|
||||
print $langs->trans('DateEnd') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end');
|
||||
print '</div>';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $formaccounting->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
|
||||
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $formaccounting->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
|
||||
print '</div>';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $formaccounting->select_auxaccount($search_subledger_account_start, 'search_subledger_account_start', 1);
|
||||
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $formaccounting->select_auxaccount($search_subledger_account_end, 'search_subledger_account_end', 1);
|
||||
print '</div>';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("NumPiece", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Doctype", $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("ThirdPartyAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Sens", $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=4 class="flat" name="search_piece_num" value="' . $search_piece_num . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=7 class="flat" name="search_doc_type" value="' . $search_doc_type . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=6 class="flat" name="search_doc_ref" value="' . $search_doc_ref . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=6 class="flat" name="search_numero_compte" value="' . $search_numero_compte . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=6 class="flat" name="search_subledger_account" value="' . $search_subledger_account . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=6 class="flat" name="search_label_operation" value="' . $search_label_operation . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input type="text" size=2 class="flat" name="search_sens" value="' . $search_sens . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input type="text" size=3 class="flat" name="search_code_journal" value="' . $search_code_journal . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $line->piece_num . '</td>' . "\n";
|
||||
print '<td>' . $line->doc_type . '</td>' . "\n";
|
||||
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';
|
||||
print '<td>' . $line->doc_ref . '</td>';
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
print '<td>' . $line->label_operation . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="right">' . price($line->montant) . '</td>';
|
||||
print '<td align="center">' . $line->sens . '</td>';
|
||||
print '<td align="right">' . $line->code_journal . '</td>';
|
||||
print '<td align="center"><a href="./card.php?action=update&piece_num=' . $line->piece_num . '">' . img_edit() . '</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -172,10 +172,10 @@ print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.thirdparty_code, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.thirdparty_code = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
|
||||
@ -188,10 +188,10 @@ print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.thirdparty_code, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||
|
||||
if (dol_strlen($search_year)) {
|
||||
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||
|
||||
@ -30,6 +30,21 @@
|
||||
*/
|
||||
class AccountingAccount extends CommonObject
|
||||
{
|
||||
public $element='accounting_account';
|
||||
public $table_element='accounting_account';
|
||||
public $picto = 'billr';
|
||||
|
||||
/**
|
||||
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
* @var int
|
||||
*/
|
||||
public $ismultientitymanaged = 1;
|
||||
/**
|
||||
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||
* @var integer
|
||||
*/
|
||||
public $restrictiononfksoc = 1;
|
||||
|
||||
var $db;
|
||||
var $error;
|
||||
var $errors;
|
||||
@ -48,13 +63,17 @@ class AccountingAccount extends CommonObject
|
||||
var $active; // duplicate with status
|
||||
var $status;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handle
|
||||
*/
|
||||
function __construct($db) {
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,7 +82,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
||||
* @return int <0 if KO, Id of record if OK and found
|
||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
|
||||
global $conf;
|
||||
@ -91,6 +110,7 @@ class AccountingAccount extends CommonObject
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->ref = $obj->account_number;
|
||||
$this->datec = $obj->datec;
|
||||
$this->tms = $obj->tms;
|
||||
$this->fk_pcg_version = $obj->fk_pcg_version;
|
||||
@ -115,7 +135,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -628,13 +628,15 @@ class BookKeeping extends CommonObject
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.doc_date,";
|
||||
@ -695,7 +697,6 @@ class BookKeeping extends CommonObject
|
||||
if (! empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array ();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -737,7 +738,7 @@ class BookKeeping extends CommonObject
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,7 +781,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.tms as date_modification";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
@ -848,7 +850,8 @@ class BookKeeping extends CommonObject
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $obj->date_creation;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
|
||||
$this->lines[] = $line;
|
||||
}
|
||||
|
||||
@ -56,18 +56,18 @@ class lettering extends BookKeeping
|
||||
/**
|
||||
* Prise en charge des lettering complexe avec prelevment , virement
|
||||
*/
|
||||
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.thirdparty_code, ";
|
||||
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.subledger_account, ";
|
||||
$sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant ";
|
||||
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE ( ";
|
||||
if (! empty($object->code_compta))
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||
$sql .= " OR ";
|
||||
if (! empty($object->code_compta_fournisseur))
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||
@ -94,13 +94,13 @@ class lettering extends BookKeeping
|
||||
$sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) ";
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
|
||||
@ -121,13 +121,13 @@ class lettering extends BookKeeping
|
||||
$sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3) ";
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
|
||||
@ -152,13 +152,13 @@ class lettering extends BookKeeping
|
||||
$sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) ";
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
|
||||
@ -179,13 +179,13 @@ class lettering extends BookKeeping
|
||||
$sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2) ";
|
||||
$sql .= " AND ( ";
|
||||
if (! empty($object->code_compta)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||
}
|
||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " OR ";
|
||||
}
|
||||
if (! empty($object->code_compta_fournisseur)) {
|
||||
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||
}
|
||||
$sql .= " ) ";
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent');
|
||||
$sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
||||
|
||||
@ -71,7 +71,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0) { $page = 0; }
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -200,7 +200,7 @@ $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 . "accounting_account as aa ON p.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||
$sql.= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
|
||||
@ -225,7 +225,7 @@ if ($result) {
|
||||
'accountancy_code' => $compta_user,
|
||||
);
|
||||
|
||||
// Variable bookkeeping
|
||||
// Variable bookkeeping ($obj->rowid is Bank Id)
|
||||
$tabpay[$obj->rowid]["date"] = $obj->do;
|
||||
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
||||
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
||||
@ -303,6 +303,7 @@ if ($result) {
|
||||
}
|
||||
$chargestatic->ref = $chargestatic->lib;
|
||||
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
||||
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
||||
|
||||
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
|
||||
@ -401,7 +402,9 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
|
||||
$error = 0;
|
||||
foreach ( $tabpay as $key => $val ) { // $key is rowid into llx_bank
|
||||
foreach ( $tabpay as $key => $val ) // $key is rowid into llx_bank
|
||||
{
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
@ -423,7 +426,14 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
// Line into bank account
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
if ($mt) {
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = $langs->trans("Bank");
|
||||
$reflabel.= ' '.$val['bank_account_ref'];
|
||||
if (! empty($val['soclib'])) {
|
||||
$reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
|
||||
}
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $ref;
|
||||
@ -442,31 +452,8 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->date_create = $now;
|
||||
|
||||
// No subledger_account value for the bank line but add a specific label_operation
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_vat') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
} else if ($tabtype[$key] == 'payment_donation') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
} else if ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
} else if ($tabtype[$key] == 'unknown') {
|
||||
// ???
|
||||
$bookkeeping->subledger_account = '';
|
||||
}
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $reflabel;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
@ -491,108 +478,151 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (! $errorforline && is_array($tabtp[$key]))
|
||||
if (! $errorforline)
|
||||
{
|
||||
// Line into thirdparty account
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $ref;
|
||||
$bookkeeping->doc_type = 'bank';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->date_create = $now;
|
||||
if (is_array($tabtp[$key]))
|
||||
{
|
||||
// Line into thirdparty account
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = dol_string_nohtmltag($val['soclib']);
|
||||
|
||||
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $objmid->labelc;
|
||||
} else if ($tabtype[$key] == 'payment_vat') {
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_donation') {
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'banktransfert') {
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else {
|
||||
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
|
||||
{
|
||||
// Temporary account
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $ref;
|
||||
$bookkeeping->doc_type = 'bank';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->date_create = $now;
|
||||
|
||||
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $objmid->labelc;
|
||||
} else if ($tabtype[$key] == 'payment_vat') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_donation') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'banktransfert') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else {
|
||||
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
|
||||
{
|
||||
// Temporary account
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
||||
$bookkeeping->label_compte = '';
|
||||
}
|
||||
}
|
||||
|
||||
$bookkeeping->label_operation = $reflabel;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // If thirdparty unkown, output the waiting account
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = 'WaitingAccount';
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $ref;
|
||||
$bookkeeping->doc_type = 'bank';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->label_compte = '';
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
$bookkeeping->label_operation = $reflabel;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -662,101 +692,102 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$companystatic = new Client($db);
|
||||
$userstatic = new User($db);
|
||||
// CSV header line
|
||||
print '"' . $langs->trans("BankId").'"' . $sep;
|
||||
print '"' . $langs->trans("Date") . '"' . $sep;
|
||||
print '"' . $langs->trans("PaymentMode") . '"' . $sep;
|
||||
print '"' . $langs->trans("AccountAccounting") . '"' . $sep;
|
||||
print '"' . $langs->trans("LedgerAccount") . '"' . $sep;
|
||||
print '"' . $langs->trans("SubledgerAccount") . '"' . $sep;
|
||||
print '"' . $langs->trans("Label"). '"' . $sep;
|
||||
print '"' . $langs->trans("Amount") . '"' . $sep;
|
||||
print '"' . $langs->trans("Amount") . '"' . $sep;
|
||||
print '"' . $langs->trans("Journal") . '"' . $sep;
|
||||
print '"' . $langs->trans("Note") . '"' . $sep;
|
||||
print "\n";
|
||||
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
|
||||
foreach ( $tabpay as $key => $val )
|
||||
{
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
//
|
||||
if (! empty($tabcompany[$key]['id']))
|
||||
{
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$companystatic->id = 0;
|
||||
$companystatic->name = '';
|
||||
}
|
||||
if (! empty($tabuser[$key]['id']))
|
||||
{
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->lastname = $tabuser[$key]['lastname'];
|
||||
$userstatic->firstname = $tabuser[$key]['firstname'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic->id = 0;
|
||||
$userstatic->lastname = '';
|
||||
$userstatic->firstname = '';
|
||||
}
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = $langs->trans("Bank");
|
||||
$reflabel.= ' '.$val['bank_account_ref'];
|
||||
if (! empty($val['soclib'])) {
|
||||
$reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
|
||||
}
|
||||
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $reflabel . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
||||
print "\n";
|
||||
}
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = dol_string_nohtmltag($val['soclib']);
|
||||
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
} else if($tabtype[$key] == 'payment') {
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
} else if($tabtype[$key] == 'payment_expensereport') {
|
||||
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
|
||||
} else if($tabtype[$key] == 'payment_salary') {
|
||||
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
|
||||
} else {
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
}
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . $reflabel . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else { // If thirdparty unkown, output the waiting account
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = 'WaitingAccount';
|
||||
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print "" . $sep;
|
||||
print '"' . $reflabel . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
|
||||
print "\n";
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -862,7 +893,8 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$r = '';
|
||||
|
||||
foreach ( $tabpay as $key => $val ) { // $key is rowid in llx_bank
|
||||
foreach ( $tabpay as $key => $val ) // $key is rowid in llx_bank
|
||||
{
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
@ -870,48 +902,55 @@ if (empty($action) || $action == 'view') {
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
//var_dump($tabpay[$key]);
|
||||
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
if ($mt)
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
$reflabel = $langs->trans("Bank");
|
||||
$reflabel.= ' '.$val['bank_account_ref'];
|
||||
if (! empty($val['soclib'])) {
|
||||
$reflabel .= " - " . $val['soclib'];
|
||||
}
|
||||
|
||||
//var_dump($tabpay[$key]);
|
||||
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accounttoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
/*$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accounttoshow;*/
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $reflabel;
|
||||
print "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
else print $accounttoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
/*$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accounttoshow;*/
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
//var_dump($tabpay[$key]);
|
||||
print $langs->trans("Bank");
|
||||
print ' '.$val['bank_account_ref'];
|
||||
if (! empty($val['soclib'])) {
|
||||
print " - " . $val['soclib'];
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($k != 'type') {
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = $val['soclib'];
|
||||
|
||||
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td></td>";
|
||||
@ -974,42 +1013,47 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else { // Waiting account
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
if ($mt)
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
$reflabel = 'WaitingAccount';
|
||||
|
||||
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
}
|
||||
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
}
|
||||
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
*/
|
||||
print "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
}
|
||||
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
*/
|
||||
print "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1089,6 +1133,13 @@ function getSourceDocRef($val, $typerecord)
|
||||
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
||||
$ref = $langs->trans("SalaryPayment");
|
||||
}
|
||||
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->trans("SocialContribution");
|
||||
}
|
||||
elseif ($typerecord == 'payment_vat')
|
||||
{
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
@ -1101,7 +1152,7 @@ function getSourceDocRef($val, $typerecord)
|
||||
$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->trans("Donation").' ';
|
||||
$ref = $langs->trans("Donation");
|
||||
}
|
||||
elseif ($typerecord == 'payment_various')
|
||||
{
|
||||
@ -1129,5 +1180,6 @@ function getSourceDocRef($val, $typerecord)
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
$ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 ... i< < than max size of 300
|
||||
return $ref;
|
||||
}
|
||||
|
||||
@ -554,14 +554,15 @@ if (empty($action) || $action == 'view') {
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
console.log("click on writebookkeeping");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
@ -180,9 +180,9 @@ if ($result) {
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
||||
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->description;
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
//$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
||||
|
||||
// Avoid warnings
|
||||
@ -219,6 +219,9 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
|
||||
$errorforline = 0;
|
||||
@ -228,22 +231,37 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->fournisseur = 1;
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
$invoicestatic->close_code = $val["close_code"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||
$replacedinvoice = 0;
|
||||
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||
if ($replacedinvoice == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
@ -262,7 +280,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||
@ -313,7 +331,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -370,7 +388,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -420,7 +438,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' NPR';
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' NPR';
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -523,65 +541,84 @@ if ($action == 'exportcsv') {
|
||||
|
||||
foreach ( $tabfac as $key => $val )
|
||||
{
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->fournisseur = 1;
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
|
||||
$invoicestatic->close_code = $val["close_code"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||
$replacedinvoice = 0;
|
||||
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||
if ($replacedinvoice == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
@ -600,21 +637,24 @@ if ($action == 'exportcsv') {
|
||||
}
|
||||
|
||||
// VAT counterpart for NPR
|
||||
foreach ( $tabother[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
if (is_array($tabother[$key]))
|
||||
{
|
||||
foreach ( $tabother[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -669,6 +709,7 @@ if (empty($action) || $action == 'view') {
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
console.log("click on writebookkeeping");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
@ -701,20 +742,54 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
foreach ( $tabfac as $key => $val )
|
||||
{
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->fournisseur = 1;
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
|
||||
$invoicestatic->close_code = $val["close_code"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||
$replacedinvoice = 0;
|
||||
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||
if ($replacedinvoice == 1)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Replaced invoice --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td><strike>" . $invoicestatic->getNomUrl(1) . "</strike></td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
print $langs->trans("Replaced");
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right"></td>';
|
||||
print "</tr>";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -89,7 +89,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
@ -190,6 +190,7 @@ if ($result) {
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
||||
|
||||
// Avoid warnings
|
||||
@ -222,6 +223,9 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
|
||||
$errorforline = 0;
|
||||
@ -231,18 +235,35 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->close_code = $val["close_code"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||
$replacedinvoice = 0;
|
||||
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||
if ($replacedinvoice == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
@ -482,13 +503,31 @@ if ($action == 'exportcsv') {
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_supplier'];
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->ref = (string) $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->close_code = $val["close_code"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||
$replacedinvoice = 0;
|
||||
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||
if ($replacedinvoice == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
@ -604,6 +643,7 @@ if (empty($action) || $action == 'view') {
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
console.log("click on writebookkeeping");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
@ -631,15 +671,11 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$r = '';
|
||||
|
||||
$invoicestatic = new Facture($db);
|
||||
$companystatic = new Client($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val )
|
||||
{
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
@ -648,10 +684,47 @@ if (empty($action) || $action == 'view') {
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->close_code = $val["close_code"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||
$replacedinvoice = 0;
|
||||
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||
if ($replacedinvoice == 1)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Replaced invoice --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td><strike>" . $invoicestatic->getNomUrl(1) . "</strike></td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
print $langs->trans("Replaced");
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>";
|
||||
print "</td>";
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right"></td>';
|
||||
print "</tr>";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Thirdparty --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
@ -681,7 +754,8 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
@ -713,7 +787,8 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
foreach ($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
@ -114,7 +114,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent');
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1);
|
||||
|
||||
@ -73,7 +73,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0) { $page = 0; }
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -53,7 +53,7 @@ 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'), 'chaine', 0, '', $conf->entity);
|
||||
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha')?0:1, 'chaine', 0, '', $conf->entity);
|
||||
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$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);
|
||||
@ -162,7 +162,7 @@ print "</tr>\n";
|
||||
|
||||
// Login/Pass required for members
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
|
||||
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1);
|
||||
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Mail required for members
|
||||
|
||||
@ -148,10 +148,10 @@ if ($object->id > 0)
|
||||
//print '</div>';
|
||||
|
||||
|
||||
$morehtmlcenter = '';
|
||||
$createbutton = '';
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
|
||||
$createbutton.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
@ -162,7 +162,7 @@ if ($object->id > 0)
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
|
||||
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $createbutton, '', 0, 1, 1);
|
||||
|
||||
// List of all actions
|
||||
$filters=array();
|
||||
|
||||
@ -528,7 +528,10 @@ class Adherent extends CommonObject
|
||||
{
|
||||
//var_dump($this->user_login);exit;
|
||||
//var_dump($this->login);exit;
|
||||
$luser->login=$this->login;
|
||||
|
||||
// If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one.
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login=$this->login;
|
||||
|
||||
$luser->civility_id=$this->civility_id;
|
||||
$luser->firstname=$this->firstname;
|
||||
$luser->lastname=$this->lastname;
|
||||
|
||||
@ -88,7 +88,7 @@ class Subscription extends CommonObject
|
||||
$sql.= " '".$this->db->escape($this->note)."')";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($res===false) {
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Line numbering
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
@ -552,10 +552,7 @@ print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
{
|
||||
print '<td colspan="1" align="center">'.$langs->trans("NumberingShort").'</td>';
|
||||
}
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID",$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
|
||||
@ -611,9 +608,9 @@ while ($i < min($num, $limit))
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||
{
|
||||
print '<td align="center">'.($i+1).'</td>';
|
||||
print '<td align="center">'.$obj->rowid.'</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
@ -36,18 +36,28 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
$langs->load("mails");
|
||||
$langs->load('other');
|
||||
$langs->loadLangs(array("companies","bills","members","users","mails",'other'));
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$rowid=GETPOST('rowid','int')?GETPOST('rowid','int'):GETPOST('id','int');
|
||||
$typeid=GETPOST('typeid','int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (! $sortfield) $sortfield="c.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user,'adherent',$rowid,'','cotisation');
|
||||
|
||||
@ -98,6 +108,7 @@ $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') :
|
||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -582,6 +593,16 @@ $title=$langs->trans("Member") . " - " . $langs->trans("Subscriptions");
|
||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
$param.= '&id='.$rowid;
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
|
||||
if ($rowid > 0)
|
||||
{
|
||||
$res=$object->fetch($rowid);
|
||||
@ -776,7 +797,7 @@ if ($rowid > 0)
|
||||
|
||||
|
||||
/*
|
||||
* Hotbar
|
||||
* Action buttons
|
||||
*/
|
||||
|
||||
// Button to create a new subscription if member no draft neither resiliated
|
||||
@ -810,6 +831,7 @@ if ($rowid > 0)
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -822,7 +844,7 @@ if ($rowid > 0)
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print_liste_field_titre('Ref',$_SERVER["PHP_SELF"],'c.rowid','',$param,'',$sortfield,$sortorder);
|
||||
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||
@ -1016,8 +1038,9 @@ if ($rowid > 0)
|
||||
$paymentdate=dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
// Date start subscription
|
||||
print '<tr><td width="30%" class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
||||
if (GETPOST('reday'))
|
||||
{
|
||||
$datefrom=dol_mktime(0,0,0,GETPOST('remonth'),GETPOST('reday'),GETPOST('reyear'));
|
||||
|
||||
@ -262,17 +262,17 @@ if ($action == 'removelogo')
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
dol_delete_file($logofile);
|
||||
if ($mysoc->logo != '') dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity);
|
||||
$mysoc->logo='';
|
||||
|
||||
$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
||||
dol_delete_file($logosmallfile);
|
||||
if ($mysoc->logo_small != '') dol_delete_file($logosmallfile);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
|
||||
$mysoc->logo_small='';
|
||||
|
||||
$logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
|
||||
dol_delete_file($logominifile);
|
||||
if ($mysoc->logo_mini != '') dol_delete_file($logominifile);
|
||||
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
|
||||
$mysoc->logo_mini='';
|
||||
}
|
||||
@ -370,7 +370,6 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
|
||||
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
|
||||
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
@ -384,8 +383,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
}
|
||||
|
||||
// Logo
|
||||
|
||||
print '<tr'.dol_bc($var,'hideonsmartphone').'><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
|
||||
print '<tr class="oddeven hideonsmartphone"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<input type="file" class="flat class=minwidth200" name="logo" id="logo">';
|
||||
print '</td><td class="nocellnopadd" valign="middle" align="right">';
|
||||
@ -402,7 +400,6 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
|
||||
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -187,7 +187,7 @@ $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAI
|
||||
$tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
|
||||
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
|
||||
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
|
||||
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
|
||||
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
@ -265,7 +265,7 @@ $tabfield[9] = "code,label,unicode";
|
||||
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[11]= "element,source,code,libelle,position";
|
||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfield[13]= "code,libelle,type,accountancy_code,entity";
|
||||
$tabfield[13]= "code,libelle,type,entity";
|
||||
$tabfield[14]= "code,libelle,price,organization,country_id,country";
|
||||
$tabfield[15]= "code,libelle,width,height,unit";
|
||||
$tabfield[16]= "code,libelle,sortorder";
|
||||
@ -304,7 +304,7 @@ $tabfieldvalue[9] = "code,label,unicode";
|
||||
$tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[11]= "element,source,code,libelle,position";
|
||||
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldvalue[13]= "code,libelle,type,accountancy_code";
|
||||
$tabfieldvalue[13]= "code,libelle,type";
|
||||
$tabfieldvalue[14]= "code,libelle,price,organization,country";
|
||||
$tabfieldvalue[15]= "code,libelle,width,height,unit";
|
||||
$tabfieldvalue[16]= "code,libelle,sortorder";
|
||||
@ -343,7 +343,7 @@ $tabfieldinsert[9] = "code_iso,label,unicode";
|
||||
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfieldinsert[13]= "code,libelle,type,accountancy_code,entity";
|
||||
$tabfieldinsert[13]= "code,libelle,type,entity";
|
||||
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
|
||||
$tabfieldinsert[15]= "code,label,width,height,unit";
|
||||
$tabfieldinsert[16]= "code,label,sortorder";
|
||||
|
||||
103
htdocs/admin/export.php
Normal file
103
htdocs/admin/export.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/expedition.php
|
||||
* \ingroup expedition
|
||||
* \brief Page d'administration/configuration du module Expedition
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("exports");
|
||||
|
||||
$langs->load('other');
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$value=GETPOST('value','alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$page_name = "ExportSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
|
||||
. $langs->trans("BackToModuleList") . '</a>';
|
||||
print_fiche_titre($langs->trans($page_name), $linkback);
|
||||
|
||||
// Configuration header
|
||||
|
||||
dol_fiche_head(
|
||||
$head,
|
||||
'settings',
|
||||
$langs->trans("ExportsArea"),
|
||||
0,
|
||||
"exports"
|
||||
);
|
||||
|
||||
// Setup page goes here
|
||||
$form=new Form($db);
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ExportModel").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="center" width="100"></td>'."\n";
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("set_EXPORTS_SHARE_MODELS").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="center" width="100">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_EXPORTS_SHARE_MODELS">';
|
||||
echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -127,7 +127,7 @@ if ($_POST["delete"])
|
||||
|
||||
// Supprime boite box_external_rss de definition des boites
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||
$sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".GETPOST("norss")." %'";
|
||||
$sql.= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss"))." %'";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -268,19 +268,19 @@ if ($resql)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td width=\"100px\">".$langs->trans("Title")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_title_" . $idrss . "\" value=\"" . $conf->global->$keyrsstitle . "\"></td>";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("URL")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat minwidth300\" name=\"external_rss_urlrss_" . $idrss . "\" value=\"" . $conf->global->$keyrssurl . "\"></td>";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("Status")."</td>";
|
||||
print "<td>";
|
||||
@ -301,7 +301,7 @@ if ($resql)
|
||||
// Logo
|
||||
if ($result > 0 && empty($rss->error))
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("Logo")."</td>";
|
||||
print '<td>';
|
||||
|
||||
@ -80,8 +80,8 @@ print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'
|
||||
if (! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
@ -92,8 +92,8 @@ print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
@ -70,6 +70,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||
if ($action == 'update' && empty($_POST["cancel"]))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"),'chaine',0,'',$conf->entity);
|
||||
// Send mode parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity);
|
||||
@ -239,6 +240,11 @@ if ($action == 'edit')
|
||||
print $form->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>';
|
||||
print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO)?$conf->global->MAIN_MAIL_FORCE_SENDTO:'') . '" />';
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2"> </td></tr>';
|
||||
@ -478,6 +484,11 @@ else
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
|
||||
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO) && ! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2"> </td></tr>';
|
||||
@ -644,25 +655,7 @@ else
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||
{
|
||||
print '<br>';
|
||||
/*
|
||||
// Warning 1
|
||||
if ($linuxlike)
|
||||
{
|
||||
$sendmailoption=ini_get('mail.force_extra_parameters');
|
||||
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
|
||||
{
|
||||
print info_admin($langs->trans("SendmailOptionNotComplete"));
|
||||
}
|
||||
}*/
|
||||
// Warning 2
|
||||
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
||||
}
|
||||
|
||||
|
||||
// Boutons actions
|
||||
// Actions button
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
@ -689,6 +682,22 @@ else
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||
{
|
||||
/*
|
||||
// Warning 1
|
||||
if ($linuxlike)
|
||||
{
|
||||
$sendmailoption=ini_get('mail.force_extra_parameters');
|
||||
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
|
||||
{
|
||||
print info_admin($langs->trans("SendmailOptionNotComplete"));
|
||||
}
|
||||
}*/
|
||||
// Warning 2
|
||||
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && ! in_array($action, array('testconnect', 'test', 'testhtml')))
|
||||
{
|
||||
$text = $langs->trans("WarningPHPMail");
|
||||
|
||||
@ -127,7 +127,7 @@ print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Affiche lignes des permissions
|
||||
// Show permissions lines
|
||||
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
|
||||
@ -39,8 +39,7 @@ $action = GETPOST('action', 'alpha');
|
||||
|
||||
// Other parameters SALARIES_*
|
||||
$list = array (
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
|
||||
'SALARIES_XXX',
|
||||
);
|
||||
|
||||
/*
|
||||
@ -97,7 +96,7 @@ print "</tr>\n";
|
||||
|
||||
foreach ($list as $key)
|
||||
{
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ foreach($configfileparameters as $key)
|
||||
if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
|
||||
else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
|
||||
else print ${$newkey};
|
||||
if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
print "</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -389,7 +389,7 @@ foreach($configfileparameters as $key => $value)
|
||||
}
|
||||
}
|
||||
else print ${$newkey};
|
||||
if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
|
||||
print "</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -428,14 +428,14 @@ if ($mode == 'searchkey')
|
||||
$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
foreach($filearray as $file)
|
||||
{
|
||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$moduledirname =(basename(dirname(dirname($dir_lang))));
|
||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$moduledirname =(basename(dirname(dirname($dir_lang))));
|
||||
|
||||
$langkey=$tmpfile;
|
||||
if ($i > 0) $langkey.='@'.$moduledirname;
|
||||
//var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey);
|
||||
$langkey=$tmpfile;
|
||||
if ($i > 0) $langkey.='@'.$moduledirname;
|
||||
//var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey);
|
||||
|
||||
$result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite
|
||||
$result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite
|
||||
$result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only
|
||||
if ($result < 0) print 'Failed to load language file '.$tmpfile.'<br>'."\n";
|
||||
else $nbtotaloffiles++;
|
||||
@ -447,8 +447,8 @@ if ($mode == 'searchkey')
|
||||
// Now search into translation array
|
||||
foreach($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/i', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/i', $val)) continue;
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey,'/').'/i', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue,'/').'/i', $val)) continue;
|
||||
$recordtoshow[$key]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ $tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -522,7 +522,6 @@ if ($id)
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
// List of websites in database
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -87,7 +87,13 @@ foreach ($modulesdir as $dir)
|
||||
$part = 'compta/facture';
|
||||
$obj = 'facture';
|
||||
}
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
if ($module == 'ficheinter') {
|
||||
$obj = 'fichinter';
|
||||
$part = 'fichinter';
|
||||
$module='fichinter';
|
||||
}
|
||||
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
|
||||
@ -388,14 +388,14 @@ class Documents extends DolibarrApi
|
||||
* Upload a file.
|
||||
*
|
||||
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
|
||||
*
|
||||
* @param string $filename Name of file to create ('FA1705-0123.txt')
|
||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
||||
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
||||
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
|
||||
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64)
|
||||
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'}
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
*
|
||||
* @throws 200
|
||||
|
||||
@ -79,6 +79,9 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
|
||||
}
|
||||
|
||||
|
||||
// This 2 lines are usefull only if we want to exclude some Urls from the explorer
|
||||
//use Luracast\Restler\Explorer;
|
||||
//Explorer::$excludedPaths = array('/categories');
|
||||
|
||||
|
||||
// Analyze URLs
|
||||
@ -142,6 +145,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
$modulenameforenabled = $module;
|
||||
if ($module == 'propale') { $modulenameforenabled='propal'; }
|
||||
if ($module == 'supplierproposal') { $modulenameforenabled='supplier_proposal'; }
|
||||
if ($module == 'ficheinter') { $modulenameforenabled='ficheinter'; }
|
||||
|
||||
dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);
|
||||
|
||||
@ -214,7 +218,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
|
||||
// Load a dedicated API file
|
||||
dol_syslog("Load a dedicated API file moduledirforclass=".$moduledirforclass);
|
||||
dol_syslog("Load a dedicated API file module=".$module." moduledirforclass=".$moduledirforclass);
|
||||
|
||||
$tmpmodule = $module;
|
||||
if ($tmpmodule != 'api')
|
||||
@ -226,6 +230,11 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
$classfile = 'supplier_orders';
|
||||
if ($module == 'supplierinvoices')
|
||||
$classfile = 'supplier_invoices';
|
||||
if ($module == 'ficheinter')
|
||||
$classfile = 'interventions';
|
||||
if ($module == 'interventions')
|
||||
$classfile = 'interventions';
|
||||
|
||||
$dir_part_file = dol_buildpath('/' . $moduledirforclass . '/class/api_' . $classfile . '.class.php', 0, 2);
|
||||
|
||||
$classname = ucwords($module);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2018 Laurent Destailleur <eldy@destailleur.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
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2018 Laurent Destailleur <eldy@destailleur.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
|
||||
@ -26,27 +27,30 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->loadLangs(array("admin", "other", "blockedlog", "bills"));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if ((! $user->admin && ! $user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'blockedloglist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$showonlyerrors = GETPOST('showonlyerrors','int');
|
||||
$search_showonlyerrors = GETPOST('search_showonlyerrors','int');
|
||||
if ($search_showonlyerrors < 0) $search_showonlyerrors=0;
|
||||
|
||||
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
||||
$search_start = -1;
|
||||
if(GETPOST('search_startyear')!='') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
|
||||
if (GETPOST('search_startyear')!='') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
|
||||
$search_end = -1;
|
||||
if(GETPOST('search_endyear')!='') $search_end= dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
|
||||
if (GETPOST('search_endyear')!='') $search_end= dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
|
||||
$search_code = GETPOST('search_code', 'alpha');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
|
||||
if (($search_start == -1 || empty($search_start)) && ! GETPOSTISSET('search_startmonth')) $search_start = dol_time_plus_duree(dol_now(), '-1', 'w');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
@ -80,6 +84,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_code = '';
|
||||
$search_ref = '';
|
||||
$search_amount = '';
|
||||
$search_showonlyerrors = 0;
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
@ -98,57 +103,148 @@ if ($action === 'downloadblockchain') {
|
||||
|
||||
exit;
|
||||
}
|
||||
else if($action === 'downloadcsv') {
|
||||
else if (GETPOST('downloadcsv','alpha'))
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY rowid ASC";
|
||||
$res = $db->query($sql);
|
||||
$previoushash='';
|
||||
$firstid='';
|
||||
|
||||
if($res) {
|
||||
|
||||
$signature = $block_static->getSignature();
|
||||
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-disposition: attachment; filename=\"archive-log-" .$signature. ".csv\"");
|
||||
|
||||
print $langs->transnoentities('Id')
|
||||
.';'.$langs->transnoentities('Date')
|
||||
.';'.$langs->transnoentities('User')
|
||||
.';'.$langs->transnoentities('Action')
|
||||
.';'.$langs->transnoentities('Element')
|
||||
.';'.$langs->transnoentities('Amounts')
|
||||
.';'.$langs->transnoentities('ObjectId')
|
||||
.';'.$langs->transnoentities('Date')
|
||||
.';'.$langs->transnoentities('Ref')
|
||||
.';'.$langs->transnoentities('Fingerprint')
|
||||
.';'.$langs->transnoentities('FullData')
|
||||
."\n";
|
||||
|
||||
while($obj = $db->fetch_object($res)) {
|
||||
|
||||
print $obj->rowid
|
||||
.';'.$obj->date_creation
|
||||
.';"'.$obj->user_fullname.'"'
|
||||
.';'.$obj->action
|
||||
.';'.$obj->element
|
||||
.';'.$obj->amounts
|
||||
.';'.$obj->fk_object
|
||||
.';'.$obj->date_object
|
||||
.';"'.$obj->ref_object.'"'
|
||||
.';'.$obj->signature
|
||||
.';"'.str_replace('"','""',$obj->object_data).'"'
|
||||
."\n";
|
||||
if (! $error)
|
||||
{
|
||||
// Get ID of first line
|
||||
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
if (GETPOST('yeartoexport','int') > 0)
|
||||
{
|
||||
$dates = dol_get_first_day(GETPOST('yeartoexport','int'), 1);
|
||||
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12);
|
||||
$sql.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
|
||||
}
|
||||
$sql.= " ORDER BY rowid ASC"; // Required so we get the first one
|
||||
$sql.= $db->plimit(1);
|
||||
|
||||
exit;
|
||||
}
|
||||
else{
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
$res = $db->query($sql);
|
||||
if($res)
|
||||
{
|
||||
// Make the first fetch to get first line
|
||||
$obj = $db->fetch_object($res);
|
||||
|
||||
$previoushash = $block_static->getPreviousHash(0, $obj->rowid);
|
||||
$firstid = $obj->rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Now restart request with all data
|
||||
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
if (GETPOST('yeartoexport','int') > 0)
|
||||
{
|
||||
$dates = dol_get_first_day(GETPOST('yeartoexport','int'), 1);
|
||||
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12);
|
||||
$sql.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
|
||||
}
|
||||
$sql.= " ORDER BY rowid ASC"; // Required so later we can use the parameter $previoushash of checkSignature()
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($res)
|
||||
{
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-disposition: attachment; filename=\"unalterable-log-archive-" .$dolibarr_main_db_name."-".(GETPOST('yeartoexport','int')>0?GETPOST('yeartoexport','int').'-':'').$previoushash. ".csv\"");
|
||||
|
||||
print $langs->transnoentities('Id')
|
||||
.';'.$langs->transnoentities('Date')
|
||||
.';'.$langs->transnoentities('User')
|
||||
.';'.$langs->transnoentities('Action')
|
||||
.';'.$langs->transnoentities('Element')
|
||||
.';'.$langs->transnoentities('Amounts')
|
||||
.';'.$langs->transnoentities('ObjectId')
|
||||
.';'.$langs->transnoentities('Date')
|
||||
.';'.$langs->transnoentities('Ref')
|
||||
.';'.$langs->transnoentities('Fingerprint')
|
||||
.';'.$langs->transnoentities('Status')
|
||||
.';'.$langs->transnoentities('Note')
|
||||
.';'.$langs->transnoentities('FullData')
|
||||
."\n";
|
||||
|
||||
$loweridinerror = 0;
|
||||
$i = 0;
|
||||
|
||||
while ($obj = $db->fetch_object($res))
|
||||
{
|
||||
// We set here all data used into signature calculation (see checkSignature method) and more
|
||||
// IMPORTANT: We must have here, the same rule for transformation of data than into the fetch method (db->jdate for date, ...)
|
||||
$block_static->id = $obj->rowid;
|
||||
$block_static->date_creation = $db->jdate($obj->date_creation);
|
||||
$block_static->date_modification = $db->jdate($obj->tms);
|
||||
$block_static->action = $obj->action;
|
||||
$block_static->fk_object = $obj->fk_object;
|
||||
$block_static->element = $obj->element;
|
||||
$block_static->amounts = (double) $obj->amounts;
|
||||
$block_static->ref_object = $obj->ref_object;
|
||||
$block_static->date_object = $db->jdate($obj->date_object);
|
||||
$block_static->user_fullname = $obj->user_fullname;
|
||||
$block_static->fk_user = $obj->fk_user;
|
||||
$block_static->signature = $obj->signature;
|
||||
$block_static->object_data = unserialize($obj->object_data);
|
||||
|
||||
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
|
||||
|
||||
if ($checksignature)
|
||||
{
|
||||
$statusofrecord = 'Valid';
|
||||
if ($loweridinerror > 0) $statusofrecordnote = 'ValidButFoundAPreviousKO';
|
||||
else $statusofrecordnote = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$statusofrecord = 'KO';
|
||||
$statusofrecordnote = 'LineCorruptedOrNotMatchingPreviousOne';
|
||||
$loweridinerror = $obj->rowid;
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
{
|
||||
$statusofrecordnote = $langs->trans("PreviousFingerprint").': '.$previoushash.($statusofrecordnote?' - '.$statusofrecordnote:'');
|
||||
}
|
||||
print $obj->rowid
|
||||
.';'.$obj->date_creation
|
||||
.';"'.$obj->user_fullname.'"'
|
||||
.';'.$obj->action
|
||||
.';'.$obj->element
|
||||
.';'.$obj->amounts
|
||||
.';'.$obj->fk_object
|
||||
.';'.$obj->date_object
|
||||
.';"'.$obj->ref_object.'"'
|
||||
.';'.$obj->signature
|
||||
.';'.$statusofrecord
|
||||
.';'.$statusofrecordnote
|
||||
.';"'.str_replace('"','""',$obj->object_data).'"'
|
||||
."\n";
|
||||
|
||||
// Set new previous hash for next fetch
|
||||
$previoushash = $obj->signature;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -169,11 +265,20 @@ else
|
||||
|
||||
llxHeader('',$langs->trans("BrowseBlockedLog"));
|
||||
|
||||
$blocks = $block_static->getLog('all', 0, GETPOST('all','alpha') ? 0 : 50, $sortfield, $sortorder, $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code);
|
||||
$MAXLINES = 10000;
|
||||
|
||||
$blocks = $block_static->getLog('all', 0, $MAXLINES, $sortfield, $sortorder, $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code);
|
||||
if (! is_array($blocks))
|
||||
{
|
||||
dol_print_error($block_static->db);
|
||||
exit;
|
||||
if ($blocks == -2)
|
||||
{
|
||||
setEventMessages($langs->trans("TooManyRecordToScanRestrictFilters", $MAXLINES), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($block_static->db, $block_static->error, $block_static->errors);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$linkback='';
|
||||
@ -197,27 +302,36 @@ print '<br>';
|
||||
$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_fk_user > 0) $param.='&search_fk_user='.urlencode($search_fk_user);
|
||||
if ($search_start > 0) $param.='&search_startyear='.urlencode(GETPOST('search_startyear','int')).'&search_startmonth='.urlencode(GETPOST('search_startmonth','int')).'&search_startday='.urlencode(GETPOST('search_startday','int'));
|
||||
if ($search_end > 0) $param.='&search_endyear='.urlencode(GETPOST('search_endyear','int')).'&search_endmonth='.urlencode(GETPOST('search_endmonth','int')).'&search_endday='.urlencode(GETPOST('search_endday','int'));
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_fk_user > 0) $param.='&search_fk_user='.urlencode($search_fk_user);
|
||||
if ($search_startyear > 0) $param.='&search_startyear='.urlencode(GETPOST('search_startyear','int'));
|
||||
if ($search_startmonth > 0) $param.='&search_startmonth='.urlencode(GETPOST('search_startmonth','int'));
|
||||
if ($search_startday > 0) $param.='&search_startday='.urlencode(GETPOST('search_startday','int'));
|
||||
if ($search_endyear > 0) $param.='&search_endyear='.urlencode(GETPOST('search_endyear','int'));
|
||||
if ($search_endmonth > 0) $param.='&search_endmonth='.urlencode(GETPOST('search_endmonth','int'));
|
||||
if ($search_endday > 0) $param.='&search_endday='.urlencode(GETPOST('search_endday','int'));
|
||||
if ($search_showonlyerrors > 0) $param.='&search_showonlyerrors='.urlencode($search_showonlyerrors);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if (GETPOST('withtab','alpha')) $param.='&withtab='.urlencode(GETPOST('withtab','alpha'));
|
||||
|
||||
// Add $param from extra fields
|
||||
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print '<div align="right">';
|
||||
print ' <a href="?all=1'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a>';
|
||||
print ' | <a href="?all=1&showonlyerrors=1'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('ShowAllFingerPrintsErrorsMightBeTooLong').'</a>';
|
||||
print ' | <a href="?action=downloadcsv'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadLogCSV').'</a>';
|
||||
print $langs->trans("RestrictYearToExport").': ';
|
||||
print '<input type="text" name="yeartoexport" class="maxwidth75" value="'.GETPOST('yeartoexport','int').'">';
|
||||
print '<input type="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">';
|
||||
print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">';
|
||||
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadBlockChain').'</a>';
|
||||
print ' </div>';
|
||||
print ' </div><br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
@ -245,7 +359,8 @@ print '</td>';
|
||||
|
||||
// User
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1);
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Actions code
|
||||
@ -262,7 +377,19 @@ print '<td class="liste_titre"></td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre right"><input type="text" class="maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
|
||||
|
||||
// Full data
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
// Fingerprint
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre">';
|
||||
$array=array("1"=>$langs->trans("OnlyNonValid"));
|
||||
print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1);
|
||||
print '</td>';
|
||||
|
||||
// Status note
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
// Action column
|
||||
@ -283,75 +410,124 @@ print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield
|
||||
print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||
print '</tr>';
|
||||
|
||||
$loweridinerror=0;
|
||||
$checkresult=array();
|
||||
foreach($blocks as &$block) {
|
||||
$checksignature = $block->checkSignature();
|
||||
$checkresult[$block->id]=$checksignature; // false if error
|
||||
if (! $checksignature)
|
||||
{
|
||||
if (empty($loweridinerror)) $loweridinerror=$block->id;
|
||||
else $loweridinerror = min($loweridinerror, $block->id);
|
||||
}
|
||||
if (! empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR))
|
||||
{
|
||||
// This is version that is faster but require more memory and report errors that are outside the filter range
|
||||
|
||||
// TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests
|
||||
// to find the $loweridinerror.
|
||||
|
||||
}
|
||||
|
||||
foreach($blocks as &$block) {
|
||||
$object_link = $block->getObjectLink();
|
||||
|
||||
if (empty($showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
|
||||
else
|
||||
{
|
||||
// This is version that optimize the memory (but will not report errors that are outside the filter range)
|
||||
$loweridinerror=0;
|
||||
$checkresult=array();
|
||||
if (is_array($blocks))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$block->id.'</td>';
|
||||
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
|
||||
print '<td>';
|
||||
//print $block->getUser()
|
||||
print $block->user_fullname;
|
||||
print '</td>';
|
||||
// Action
|
||||
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
||||
// Ref
|
||||
print '<td>'.$block->ref_object.'</td>';
|
||||
print '<td>'.$object_link.'</td>';
|
||||
print '<td align="right">'.price($block->amounts).'</td>';
|
||||
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||
foreach($blocks as &$block)
|
||||
{
|
||||
$checksignature = $block->checkSignature(); // Note: this make a sql request at each call, we can't avoid this as the sorting order is various
|
||||
$checkresult[$block->id]=$checksignature; // false if error
|
||||
if (! $checksignature)
|
||||
{
|
||||
if (empty($loweridinerror)) $loweridinerror=$block->id;
|
||||
else $loweridinerror = min($loweridinerror, $block->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature);
|
||||
print '</td>';
|
||||
if (is_array($blocks))
|
||||
{
|
||||
foreach($blocks as &$block)
|
||||
{
|
||||
$object_link = $block->getObjectLink();
|
||||
|
||||
print '<td class="center">';
|
||||
if (! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
|
||||
{
|
||||
if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut1');
|
||||
else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto($langs->trans('OkCheckFingerprintValidity'), 'statut4');
|
||||
}
|
||||
//if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
|
||||
if (empty($search_showonlyerrors) || ! $checkresult[$block->id])
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
||||
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
||||
}
|
||||
print '</td>';
|
||||
// ID
|
||||
print '<td>'.$block->id.'</td>';
|
||||
|
||||
print '</tr>';
|
||||
// Date
|
||||
print '<td>'.dol_print_date($block->date_creation,'dayhour').'</td>';
|
||||
|
||||
// User
|
||||
print '<td>';
|
||||
|
||||
//print $block->getUser()
|
||||
print $block->user_fullname;
|
||||
print '</td>';
|
||||
|
||||
// Action
|
||||
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap">'.$block->ref_object.'</td>';
|
||||
|
||||
// Link to source object
|
||||
print '<td>'.$object_link.'</td>';
|
||||
|
||||
// Amount
|
||||
print '<td align="right">'.price($block->amounts).'</td>';
|
||||
|
||||
// Details link
|
||||
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||
|
||||
// Fingerprint
|
||||
print '<td>';
|
||||
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint');
|
||||
print '</td>';
|
||||
|
||||
// Status
|
||||
print '<td class="center">';
|
||||
if (! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
|
||||
{
|
||||
if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut4');
|
||||
else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto($langs->trans('OkCheckFingerprintValidity'), 'statut4');
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Status note
|
||||
print '<td class="center">';
|
||||
if (! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
|
||||
{
|
||||
if ($checkresult[$block->id]) print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo'));
|
||||
}
|
||||
|
||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
||||
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Javascript to manage the showinfo popup
|
||||
print '<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
@ -363,36 +539,19 @@ jQuery(document).ready(function () {
|
||||
|
||||
$("a[rel=show-info]").click(function() {
|
||||
|
||||
console.log("We click on tooltip");
|
||||
|
||||
jQuery("#dialogforpopup").html(\'<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%">'.$langs->trans('Field').'</th><th>'.$langs->trans('Value').'</th></thead><tbody></tbody></table></div>\');
|
||||
console.log("We click on tooltip, we open popup and get content using an ajax call");
|
||||
|
||||
var fk_block = $(this).attr("data-blockid");
|
||||
|
||||
$.ajax({
|
||||
url:"../ajax/block-info.php?id="+fk_block
|
||||
,dataType:"json"
|
||||
,dataType:"html"
|
||||
}).done(function(data) {
|
||||
drawData(data,"");
|
||||
jQuery("#dialogforpopup").html(data);
|
||||
});
|
||||
|
||||
jQuery("#dialogforpopup").dialog("open");
|
||||
});
|
||||
|
||||
|
||||
function drawData(data, prefix) {
|
||||
for(x in data) {
|
||||
value = data[x];
|
||||
|
||||
if (typeof value != "object") {
|
||||
$("#pop-info table tbody").append("<tr><td>"+prefix+x+"</td><td class=\"wordwrap\">"+value+"</td></tr>");
|
||||
}
|
||||
if ((typeof value === "object") && (value !== null)) {
|
||||
drawData(value, prefix+x+" >> ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
</script>'."\n";
|
||||
|
||||
|
||||
@ -36,12 +36,77 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
|
||||
$id = GETPOST('id');
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$block = new BlockedLog($db);
|
||||
if ($block->fetch($id)>0) {
|
||||
echo json_encode($block->object_data);
|
||||
|
||||
if ((! $user->admin && ! $user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
print '<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
|
||||
print '<tbody>';
|
||||
|
||||
if ($block->fetch($id) > 0)
|
||||
{
|
||||
$objtoshow = $block->object_data;
|
||||
print formatObject($objtoshow, '');
|
||||
}
|
||||
else {
|
||||
echo json_encode(false);
|
||||
print 'Error, failed to get unalterable log with id '.$id;
|
||||
}
|
||||
|
||||
print '</tbody>';
|
||||
print '</table></div>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
/**
|
||||
* formatObject
|
||||
*
|
||||
* @param Object $objtoshow Object to show
|
||||
* @param string $prefix Prefix of key
|
||||
* @return string String formatted
|
||||
*/
|
||||
function formatObject($objtoshow, $prefix)
|
||||
{
|
||||
$s = '';
|
||||
|
||||
$newobjtoshow = $objtoshow;
|
||||
|
||||
if (is_object($newobjtoshow) || is_array($newobjtoshow))
|
||||
{
|
||||
//var_dump($newobjtoshow);
|
||||
foreach($newobjtoshow as $key => $val)
|
||||
{
|
||||
if (! is_object($val) && ! is_array($val))
|
||||
{
|
||||
$s.='<tr><td>'.($prefix?$prefix.' > ':'').$key.'</td>';
|
||||
$s.='<td>';
|
||||
if (in_array($key, array('date','datef')))
|
||||
{
|
||||
$s.=dol_print_date($val, 'dayhour');
|
||||
}
|
||||
else
|
||||
{
|
||||
$s.=$val;
|
||||
}
|
||||
$s.='</td></tr>';
|
||||
}
|
||||
elseif (is_array($val))
|
||||
{
|
||||
$s.=formatObject($val, ($prefix?$prefix.' > ':'').$key);
|
||||
}
|
||||
elseif (is_object($val))
|
||||
{
|
||||
$s.=formatObject($val, ($prefix?$prefix.' > ':'').$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -82,6 +82,9 @@ class BlockedLog
|
||||
*/
|
||||
public $fk_user = 0;
|
||||
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
|
||||
public $date_object = 0;
|
||||
|
||||
public $ref_object = '';
|
||||
@ -146,15 +149,14 @@ class BlockedLog
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY']='logMEMBER_SUBSCRIPTION_MODIFY';
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE']='logMEMBER_SUBSCRIPTION_DELETE';
|
||||
|
||||
/*
|
||||
$trackedevents['PAYMENT_VARIOUS_CREATE']='BlockedLogVariousPaymentCreate';
|
||||
$trackedevents['PAYMENT_VARIOUS_MODIFY']='BlockedLogVariousPaymentModify';
|
||||
$trackedevents['PAYMENT_VARIOUS_DELETE']='BlockedLogVariousPaymentDelete';
|
||||
*/
|
||||
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE']='logPAYMENT_VARIOUS_CREATE';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY']='logPAYMENT_VARIOUS_MODIFY';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE']='logPAYMENT_VARIOUS_DELETE';
|
||||
}
|
||||
|
||||
/**
|
||||
* try to retrieve logged object link
|
||||
* Try to retrieve source object (it it still exists)
|
||||
*/
|
||||
public function getObjectLink()
|
||||
{
|
||||
@ -164,7 +166,7 @@ class BlockedLog
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$object = new Facture($this->db);
|
||||
if($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
@ -175,7 +177,7 @@ class BlockedLog
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
$object = new FactureFournisseur($this->db);
|
||||
if($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
@ -186,7 +188,7 @@ class BlockedLog
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
$object = new Paiement($this->db);
|
||||
if($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
@ -197,7 +199,7 @@ class BlockedLog
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$object = new PaiementFourn($this->db);
|
||||
if($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
@ -208,7 +210,29 @@ class BlockedLog
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
|
||||
|
||||
$object = new PaymentDonation($this->db);
|
||||
if($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
else if($this->element === 'payment_various') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
|
||||
$object = new PaymentVarious($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
else if($this->element === 'don' || $this->element === 'donation') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
|
||||
$object = new Don($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
@ -285,7 +309,7 @@ class BlockedLog
|
||||
{
|
||||
$this->date_object = $object->datev;
|
||||
}
|
||||
elseif ($object->element == 'payment_donation')
|
||||
elseif ($object->element == 'payment_donation' || $object->element == 'payment_various')
|
||||
{
|
||||
$this->date_object = $object->datepaid?$object->datepaid:$object->datep;
|
||||
}
|
||||
@ -335,22 +359,44 @@ class BlockedLog
|
||||
}
|
||||
|
||||
// Add user info
|
||||
$this->fk_user = $user->id;
|
||||
$this->user_fullname = $user->getFullName($langs);
|
||||
if (! empty($user))
|
||||
{
|
||||
$this->fk_user = $user->id;
|
||||
$this->user_fullname = $user->getFullName($langs);
|
||||
}
|
||||
|
||||
// Field specific to object
|
||||
|
||||
if ($this->element == 'facture')
|
||||
{
|
||||
var_dump($object);exit;
|
||||
foreach($object as $key=>$value)
|
||||
{
|
||||
if (in_array($key, array('fields'))) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
if ($key == 'lines')
|
||||
{
|
||||
$lineid=0;
|
||||
foreach($value as $tmpline) // $tmpline is object FactureLine
|
||||
{
|
||||
$lineid++;
|
||||
foreach($tmpline as $keyline => $valueline)
|
||||
{
|
||||
if (! in_array($keyline, array(
|
||||
'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
|
||||
if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass();
|
||||
|
||||
$this->object_data->invoiceline[$lineid]->{$keyline} = $valueline;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif ($this->element == 'invoice_supplier')
|
||||
{
|
||||
@ -358,26 +404,33 @@ class BlockedLog
|
||||
{
|
||||
if (in_array($key, array('fields'))) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation')
|
||||
elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various')
|
||||
{
|
||||
$datepayment = $object->datepaye?$object->datepaye:($object->datepaid?$object->datepaid:$object->datep);
|
||||
$paymenttypeid = $object->paiementid?$object->paiementid:$object->paymenttype;
|
||||
$paymenttypeid = $object->paiementid?$object->paiementid:($object->paymenttype?$object->paymenttype:$object->type_payment);
|
||||
|
||||
$this->object_data->ref = $object->ref;
|
||||
$this->object_data->date = $datepayment;
|
||||
$this->object_data->type_code = dol_getIdFromCode($this->db, $paymenttypeid, 'c_paiement', 'id', 'code');
|
||||
$this->object_data->payment_num = $object->num_paiement;
|
||||
$this->object_data->payment_num = ($object->num_paiement?$object->num_paiement:$object->num_payment);
|
||||
//$this->object_data->fk_account = $object->fk_account;
|
||||
$this->object_data->note = $object->note;
|
||||
//var_dump($this->object_data);exit;
|
||||
|
||||
$totalamount=0;
|
||||
|
||||
if (! is_array($object->amounts) && $object->amount)
|
||||
{
|
||||
$object->amounts=array($object->id => $object->amount);
|
||||
}
|
||||
|
||||
$paymentpartnumber=0;
|
||||
foreach($object->amounts as $objid => $amount)
|
||||
{
|
||||
@ -385,6 +438,7 @@ class BlockedLog
|
||||
|
||||
$totalamount += $amount;
|
||||
|
||||
$tmpobject = null;
|
||||
if ($this->element == 'payment_supplier')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
@ -400,22 +454,41 @@ class BlockedLog
|
||||
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
$tmpobject = new Don($this->db);
|
||||
}
|
||||
elseif ($this->element == 'payment_various')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
$tmpobject = new PaymentVarious($this->db);
|
||||
}
|
||||
|
||||
if (! is_object($tmpobject))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$result = $tmpobject->fetch($objid);
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error = $tmpobject->error;
|
||||
$this->errors = $tmpobject->errors;
|
||||
dol_syslog("Failed to fetch object with id ".$objid, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$paymentpart = new stdClass();
|
||||
$paymentpart->amount = $amount;
|
||||
|
||||
if ($this->element != 'payment_donation')
|
||||
if (! in_array($this->element, array('payment_donation', 'payment_various')))
|
||||
{
|
||||
$result = $tmpobject->fetch_thirdparty();
|
||||
if ($result <= 0)
|
||||
if ($result == 0)
|
||||
{
|
||||
$this->error='Failed to fetch thirdparty for object with id '.$tmpobject->id;
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
elseif ($result < 0)
|
||||
{
|
||||
$this->error = $tmpobject->error;
|
||||
$this->errors = $tmpobject->errors;
|
||||
@ -438,28 +511,36 @@ class BlockedLog
|
||||
if ($this->element == 'payment_donation') $paymentpart->donation = new stdClass();
|
||||
else $paymentpart->invoice = new stdClass();
|
||||
|
||||
foreach($tmpobject as $key=>$value)
|
||||
if ($this->element != 'payment_various')
|
||||
{
|
||||
if (in_array($key, array('fields'))) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value))
|
||||
foreach($tmpobject as $key=>$value)
|
||||
{
|
||||
if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value;
|
||||
else $paymentpart->invoice->{$key} = $value;
|
||||
if (in_array($key, array('fields'))) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value))
|
||||
{
|
||||
if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value;
|
||||
elseif ($this->element == 'payment_various') $paymentpart->various->{$key} = $value;
|
||||
else $paymentpart->invoice->{$key} = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$paymentpartnumber++;
|
||||
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart;
|
||||
$paymentpartnumber++; // first payment will be 1
|
||||
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart;
|
||||
}
|
||||
}
|
||||
|
||||
$this->object_data->amount = $totalamount;
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif($this->element == 'payment_salary')
|
||||
{
|
||||
$this->object_data->amounts = array($object->amount);
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -596,7 +677,7 @@ class BlockedLog
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$previoushash = $this->getPreviousHash(1); // This get last record and lock database until insert is done
|
||||
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done
|
||||
|
||||
$keyforsignature = $this->buildKeyForSignature();
|
||||
|
||||
@ -667,19 +748,20 @@ class BlockedLog
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current signature still correct compare to the chain
|
||||
* Check if current signature still correct compared to the value in chain
|
||||
*
|
||||
* @return boolean True if OK, False if KO
|
||||
* @param string $previoushash If previous signature hash is known, we can provide it to avoid to make a search of it in database.
|
||||
* @return boolean True if OK, False if KO
|
||||
*/
|
||||
public function checkSignature()
|
||||
public function checkSignature($previoushash='')
|
||||
{
|
||||
|
||||
//$oldblockedlog = new BlockedLog($this->db);
|
||||
//$previousrecord = $oldblockedlog->fetch($this->id - 1);
|
||||
$previoushash = $this->getPreviousHash(0, $this->id);
|
||||
|
||||
if (empty($previoushash))
|
||||
{
|
||||
$previoushash = $this->getPreviousHash(0, $this->id);
|
||||
}
|
||||
// Recalculate hash
|
||||
$keyforsignature = $this->buildKeyForSignature();
|
||||
|
||||
$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||
$signature = dol_hash($previoushash . $keyforsignature, '5');
|
||||
//var_dump($previoushash); var_dump($keyforsignature); var_dump($signature_line); var_dump($signature);
|
||||
@ -694,7 +776,9 @@ class BlockedLog
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string for signature
|
||||
* Return a string for signature.
|
||||
* Note: rowid of line not included as it is not a business data and this allow to make backup of a year
|
||||
* and restore it into another database with different id wihtout comprimising checksums
|
||||
*
|
||||
* @return string Key for signature
|
||||
*/
|
||||
@ -709,10 +793,10 @@ class BlockedLog
|
||||
* Get previous signature/hash in chain
|
||||
*
|
||||
* @param int $withlock 1=With a lock
|
||||
* @param int $beforeid Before id
|
||||
* @return string Hash of last record
|
||||
* @param int $beforeid ID of a record
|
||||
* @return string Hash of previous record (if beforeid is defined) or hash of last record (if beforeid is 0)
|
||||
*/
|
||||
private function getPreviousHash($withlock=0, $beforeid=0)
|
||||
public function getPreviousHash($withlock=0, $beforeid=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -761,7 +845,7 @@ class BlockedLog
|
||||
* @param string $search_ref search ref
|
||||
* @param string $search_amount search amount
|
||||
* @param string $search_code search code
|
||||
* @return array array of object log
|
||||
* @return array|int Array of object log or <0 if error
|
||||
*/
|
||||
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref='', $search_amount='', $search_code='')
|
||||
{
|
||||
@ -796,21 +880,28 @@ class BlockedLog
|
||||
if ($search_end > 0) $sql.=" AND date_creation <= '".$this->db->idate($search_end)."'";
|
||||
if ($search_ref != '') $sql.=natural_search("ref_object", $search_ref);
|
||||
if ($search_amount != '') $sql.=natural_search("amounts", $search_amount, 1);
|
||||
if ($search_code != '') $sql.=natural_search("action", $search_code, 3);
|
||||
if ($search_code != '' && $search_code != '-1') $sql.=natural_search("action", $search_code, 3);
|
||||
|
||||
$sql.=$this->db->order($sortfield, $sortorder);
|
||||
|
||||
if($limit > 0 )$sql.=' LIMIT '.$limit;
|
||||
$sql.=$this->db->plimit($limit+1); // We want more, because we will stop into loop later with error if we reach max
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
|
||||
if($res) {
|
||||
|
||||
$results=array();
|
||||
|
||||
while ($obj = $this->db->fetch_object($res)) {
|
||||
$i = 0;
|
||||
while ($obj = $this->db->fetch_object($res))
|
||||
{
|
||||
$i++;
|
||||
if ($i > $limit)
|
||||
{
|
||||
// Too many record, we will consume too much memory
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (!isset($cachedlogs[$obj->rowid])) {
|
||||
if (!isset($cachedlogs[$obj->rowid]))
|
||||
{
|
||||
$b=new BlockedLog($this->db);
|
||||
$b->fetch($obj->rowid);
|
||||
|
||||
@ -822,9 +913,8 @@ class BlockedLog
|
||||
|
||||
return $results;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -103,7 +103,7 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,0,1,array(),0);
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3) AND s.status = 1',1,0,1,array(),0);
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -105,7 +105,7 @@ print '<td>';
|
||||
$disabled=0;
|
||||
$langs->load("companies");
|
||||
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
|
||||
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3)', !$disabled, 0, 0);
|
||||
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3) AND s.status = 1', !$disabled, $disabled, 1);
|
||||
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -79,7 +79,7 @@ print '<li class="menu_choix0">'.$langs->trans("User").': '.$_SESSION['firstname
|
||||
print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>';
|
||||
print '<form id="frmThirdparty" class="formulaire1 inline-block" method="post" action="facturation_verif.php?action=change_thirdparty">';
|
||||
print $langs->trans("CashDeskThirdParty").': ';
|
||||
print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', 's.client IN (1,3)', '', 0, 0, null, 0, 'valignmiddle inline-block');
|
||||
print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', 's.client IN (1,3) AND s.status = 1', '', 0, 0, null, 0, 'valignmiddle inline-block');
|
||||
print '<input class="button bouton_change_thirdparty inline-block valignmiddle" type="submit" id="bouton_change_thirdparty" value="'.$langs->trans("Modify").'">';
|
||||
//print $companyLink;
|
||||
print '<br>';
|
||||
|
||||
@ -825,7 +825,7 @@ class Categorie extends CommonObject
|
||||
$sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type];
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c";
|
||||
$sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o";
|
||||
$sql .= " WHERE o.entity IN (" . getEntity( $obj->element, 1).")";
|
||||
$sql .= " WHERE o.entity IN (" . getEntity( $obj->element).")";
|
||||
$sql.= " AND c.fk_categorie = ".$this->id;
|
||||
$sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid";
|
||||
|
||||
@ -1066,7 +1066,7 @@ class Categorie extends CommonObject
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
|
||||
$sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")";
|
||||
$sql .= " WHERE c.entity IN (" . getEntity( 'category') . ")";
|
||||
$sql .= " AND c.type = " . $type;
|
||||
|
||||
dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG);
|
||||
@ -1481,7 +1481,7 @@ class Categorie extends CommonObject
|
||||
$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
|
||||
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type];
|
||||
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
|
||||
$sql .= " AND c.entity IN (" . getEntity( 'category') . ")";
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
@ -1542,7 +1542,7 @@ class Categorie extends CommonObject
|
||||
// Generation requete recherche
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie";
|
||||
$sql .= " WHERE type = " . $this->MAP_ID[$type];
|
||||
$sql .= " AND entity IN (" . getEntity( 'category', 1 ) . ")";
|
||||
$sql .= " AND entity IN (" . getEntity( 'category') . ")";
|
||||
if ($nom)
|
||||
{
|
||||
if (! $exact)
|
||||
|
||||
@ -353,7 +353,7 @@ if ($type == Categorie::TYPE_PRODUCT)
|
||||
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")." (".count($prods).")</td></tr>\n";
|
||||
|
||||
if (count($prods) > 0)
|
||||
{
|
||||
@ -402,7 +402,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
|
||||
{
|
||||
print "<br>";
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers")." (".count($socs).")</td></tr>\n";
|
||||
|
||||
if (count($socs) > 0)
|
||||
{
|
||||
@ -451,7 +451,7 @@ if($type == Categorie::TYPE_CUSTOMER)
|
||||
{
|
||||
print "<br>";
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers")." (".count($socs).")</td></tr>\n";
|
||||
|
||||
if (count($socs) > 0)
|
||||
{
|
||||
@ -507,7 +507,7 @@ if ($type == Categorie::TYPE_MEMBER)
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member")." (".count($prods).")</td></tr>\n";
|
||||
|
||||
if (count($prods) > 0)
|
||||
{
|
||||
@ -558,7 +558,7 @@ if ($type == Categorie::TYPE_CONTACT)
|
||||
{
|
||||
print "<br>";
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Contact")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Contact")." (".count($contacts).")</td></tr>\n";
|
||||
|
||||
if (count($contacts) > 0)
|
||||
{
|
||||
@ -613,7 +613,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")." (".count($accounts).")</td></tr>\n";
|
||||
|
||||
if (count($accounts) > 0)
|
||||
{
|
||||
@ -666,7 +666,7 @@ if ($type == Categorie::TYPE_PROJECT)
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")."</td></tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")." (".count($projects).")</td></tr>\n";
|
||||
|
||||
if (count($projects) > 0)
|
||||
{
|
||||
|
||||
@ -1633,6 +1633,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL))
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ $arrayfields=array(
|
||||
'a.datep2'=>array('label'=>"DateEnd", 'checked'=>1),
|
||||
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
|
||||
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1),
|
||||
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
|
||||
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>0, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
|
||||
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
|
||||
);
|
||||
@ -427,7 +427,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['a.id']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['owner']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['c.libelle']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (! empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
||||
if (! empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>';
|
||||
if (! empty($arrayfields['a.datep']['checked'])) {
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
|
||||
@ -454,6 +454,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['a.percent']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
print ajax_combobox('selectstatus');
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
@ -560,14 +561,14 @@ if ($resql)
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['a.label']['checked'])) {
|
||||
print '<td class="tdoverflowmax300">';
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print $actionstatic->label;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Start date
|
||||
if (! empty($arrayfields['a.datep']['checked'])) {
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->dp),"dayhour");
|
||||
$late=0;
|
||||
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1;
|
||||
@ -580,7 +581,7 @@ if ($resql)
|
||||
|
||||
// End date
|
||||
if (! empty($arrayfields['a.datep2']['checked'])) {
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->dp2),"dayhour");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ if ($id > 0 && empty($object->id))
|
||||
{
|
||||
// Load data of third party
|
||||
$res=$object->fetch($id);
|
||||
if ($object->id <= 0) dol_print_error($db,$object->error,$object->errors);
|
||||
if ($object->id < 0) dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
|
||||
$title=$langs->trans("CustomerCard");
|
||||
@ -220,7 +220,7 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
|
||||
if ($id > 0)
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
@ -773,7 +773,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last sendings
|
||||
* Last shipments
|
||||
*/
|
||||
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
|
||||
$sendingstatic = new Expedition($db);
|
||||
@ -1245,7 +1245,7 @@ if ($id > 0)
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
|
||||
if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD))
|
||||
{
|
||||
// List of contacts
|
||||
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
@ -1271,7 +1271,8 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,'Bad value for socid parameter');
|
||||
$langs->load("errors");
|
||||
print $langs->trans('ErrorRecordNotFound');
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -470,7 +470,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.client IN (1, 2, 3)";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = $socid";
|
||||
$sql .= " ORDER BY s.tms DESC";
|
||||
@ -534,7 +534,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fournisseur = 1";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY s.datec DESC";
|
||||
@ -768,7 +768,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity IN (".getEntity('commande').")";
|
||||
$sql.= " AND c.fk_statut = 1";
|
||||
$sql.= " AND (c.fk_statut = ".Commande::STATUS_VALIDATED." or c.fk_statut = ".Commande::STATUS_SHIPMENTONPROCESS.")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
@ -156,6 +156,7 @@ if (empty($reshook))
|
||||
$sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
|
||||
$sql .= " ORDER BY mc.statut DESC"; // first status 0, then status -1
|
||||
|
||||
dol_syslog("card.php: select targets", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
@ -840,7 +841,7 @@ else
|
||||
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
|
||||
$_GET["action"]='';
|
||||
}
|
||||
else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1')
|
||||
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
|
||||
@ -875,7 +876,16 @@ else
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->statut == 2 || $object->statut == 3)
|
||||
{
|
||||
$nbtry = $object->countNbOfTargets('alreadysent');
|
||||
$nbko = $object->countNbOfTargets('alreadysentko');
|
||||
|
||||
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
|
||||
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
|
||||
$morehtmlright.=') ';
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
@ -903,11 +913,11 @@ else
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
|
||||
if ($object->statut != 3 && is_numeric($nbemail))
|
||||
$nbemail = ($object->nbemail?$object->nbemail:0);
|
||||
if (is_numeric($nbemail))
|
||||
{
|
||||
$text='';
|
||||
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||
{
|
||||
@ -915,9 +925,10 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
$text.=$langs->trans('NotEnoughPermissions');
|
||||
$text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
|
||||
if ($text)
|
||||
{
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
@ -1008,7 +1019,11 @@ else
|
||||
|
||||
if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider)
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send))
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("SendingFromWebInterfaceIsNotAllowed")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
}
|
||||
else if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
|
||||
}
|
||||
@ -1095,7 +1110,7 @@ else
|
||||
$htmltext.='</i>';
|
||||
|
||||
// Print mail content
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto('<span class="hideonsmartphone">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
||||
|
||||
dol_fiche_head('', '', '', -1);
|
||||
|
||||
@ -1183,15 +1198,30 @@ else
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
|
||||
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
$nbemail = ($object->nbemail?$object->nbemail:0);
|
||||
if (is_numeric($nbemail))
|
||||
{
|
||||
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
$text='';
|
||||
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||
{
|
||||
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
|
||||
if ($text)
|
||||
{
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -171,6 +171,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
|
||||
|
||||
$form = new Form($db);
|
||||
@ -185,7 +186,16 @@ if ($object->fetch($id) >= 0)
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
$nbtry = $nbok = 0;
|
||||
if ($object->statut == 2 || $object->statut == 3)
|
||||
{
|
||||
$nbtry = $object->countNbOfTargets('alreadysent');
|
||||
$nbko = $object->countNbOfTargets('alreadysentko');
|
||||
|
||||
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
|
||||
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
|
||||
$morehtmlright.=') ';
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
@ -206,15 +216,30 @@ if ($object->fetch($id) >= 0)
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($object->nbemail?$object->nbemail:'0');
|
||||
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && ($conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
|
||||
$nbemail = ($object->nbemail?$object->nbemail:0);
|
||||
if (is_numeric($nbemail))
|
||||
{
|
||||
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
$text='';
|
||||
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||
{
|
||||
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
|
||||
if ($text)
|
||||
{
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -411,6 +436,8 @@ if ($object->fetch($id) >= 0)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = "&id=".$object->id;
|
||||
//if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
|
||||
if ($search_email) $param.= "&search_email=".urlencode($search_email);
|
||||
@ -443,6 +470,7 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
if ($page) $param.= "&page=".$page;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Ligne des champs de filtres
|
||||
@ -551,7 +579,7 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Statut pour l'email destinataire (Attentioon != statut du mailing)
|
||||
// Status of recipient sending email (Warning != status of emailing)
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
print '<td align="center"> </td>';
|
||||
@ -562,18 +590,22 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
print '<td align="center">'.$obj->date_envoi.'</td>';
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $object::libStatutDest($obj->statut,2,$obj->error_text);
|
||||
print $object::libStatutDest($obj->statut, 2, $obj->error_text);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Search Icon
|
||||
print '<td align="right">';
|
||||
if ($obj->statut == 0)
|
||||
if ($obj->statut == 0) // Not sent yet
|
||||
{
|
||||
if ($user->rights->mailing->creer && $allowaddtarget) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
|
||||
}
|
||||
}
|
||||
/*if ($obj->statut == -1) // Sent with error
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
|
||||
}*/
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -590,6 +622,7 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class Mailing extends CommonObject
|
||||
public $element='mailing';
|
||||
public $table_element='mailing';
|
||||
public $picto='email';
|
||||
|
||||
|
||||
var $titre;
|
||||
var $sujet;
|
||||
var $body;
|
||||
@ -43,7 +43,7 @@ class Mailing extends CommonObject
|
||||
var $bgimage;
|
||||
|
||||
var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely
|
||||
|
||||
|
||||
var $email_from;
|
||||
var $email_replyto;
|
||||
var $email_errorsto;
|
||||
@ -431,7 +431,7 @@ class Mailing extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete targets emailing
|
||||
*
|
||||
@ -481,11 +481,11 @@ class Mailing extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Count number of target with status
|
||||
*
|
||||
* @param string $mode Mode ('alreadysent' = Sent success or error)
|
||||
* @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error)
|
||||
* @return int Nb of target with status
|
||||
*/
|
||||
function countNbOfTargets($mode)
|
||||
@ -493,12 +493,14 @@ class Mailing extends CommonObject
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.= " WHERE fk_mailing = ".$this->id;
|
||||
if ($mode == 'alreadysent') $sql.= " AND statut <> 0";
|
||||
else
|
||||
elseif ($mode == 'alreadysentok') $sql.= " AND statut > 0";
|
||||
elseif ($mode == 'alreadysentko') $sql.= " AND statut = -1";
|
||||
else
|
||||
{
|
||||
$this->error='BadValueForParameterMode';
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -512,10 +514,10 @@ class Mailing extends CommonObject
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'un mailing (brouillon, validee, ...
|
||||
* Return label of status of emailing (draft, validated, ...)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @return string Label
|
||||
|
||||
@ -774,12 +774,13 @@ if (empty($reshook))
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
// Price unique per product
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
|
||||
// On defini prix unitaire
|
||||
// If price per segment
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
|
||||
{
|
||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||
@ -792,6 +793,7 @@ if (empty($reshook))
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||
@ -814,6 +816,37 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
if ($prod->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
|
||||
$pqp = GETPOST('pbq','int');
|
||||
|
||||
// Search price into product_price_by_qty from $prod->id
|
||||
foreach($prod->prices_by_qty_list[0] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
// Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
// TODO Same than PRODUIT_CUSTOMER_PRICES_BY_QTY but using $object->thirdparty->price_level
|
||||
}
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
@ -2097,6 +2130,22 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$tmparray=$object->getTotalWeightVolume();
|
||||
$totalWeight=$tmparray['weight'];
|
||||
$totalVolume=$tmparray['volume'];
|
||||
if ($totalWeight) {
|
||||
print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
|
||||
print '<td>';
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||
print '</td></tr>';
|
||||
}
|
||||
if ($totalVolume) {
|
||||
print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
|
||||
print '<td>';
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
@ -2237,8 +2286,6 @@ if ($action == 'create')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
$var = true;
|
||||
|
||||
// Add products/services form
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
|
||||
@ -2379,8 +2426,6 @@ if ($action == 'create')
|
||||
$genallowed = $user->rights->propal->lire;
|
||||
$delallowed = $user->rights->propal->creer;
|
||||
|
||||
$var = true;
|
||||
|
||||
print $formfile->showdocuments('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
|
||||
|
||||
// Show links to link elements
|
||||
@ -2397,6 +2442,7 @@ if ($action == 'create')
|
||||
print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
|
||||
}
|
||||
|
||||
// Show direct download link
|
||||
if ($object->statut != Propal::STATUS_DRAFT && ! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD))
|
||||
{
|
||||
print '<br><!-- Link to download main doc -->'."\n";
|
||||
|
||||
@ -141,7 +141,7 @@ $checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
'pr.ref'=>array('label'=>$langs->trans("Project"), 'checked'=>1, 'enabled'=>$conf->projet->enabled),
|
||||
'pr.ref'=>array('label'=>$langs->trans("Project"), 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
@ -191,7 +191,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_refproject='';
|
||||
$search_refproject='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
|
||||
@ -76,7 +76,7 @@ $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
$sql.= " AND s.client IN (2, 3)";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " GROUP BY st.id";
|
||||
$sql.= " ORDER BY st.id";
|
||||
@ -96,7 +96,7 @@ if ($resql)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<a href="prospects.php?page=0&stcomm='.$obj->id.'">';
|
||||
print img_action($langs->trans("Show"),$obj->id).' ';
|
||||
@ -140,7 +140,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '</td><td align="right">';
|
||||
@ -150,7 +150,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
$total += $obj->price;
|
||||
}
|
||||
if ($total>0) {
|
||||
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
@ -205,7 +205,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<a href="../propal.php?id='.$obj->propalid.'">';
|
||||
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
|
||||
@ -243,7 +243,7 @@ $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fk_stcomm = 1";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
|
||||
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY s.tms ASC";
|
||||
$sql.= $db->plimit(15, 0);
|
||||
@ -263,7 +263,7 @@ if ($resql)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td width="12%">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
|
||||
@ -735,7 +735,7 @@ if (empty($reshook))
|
||||
$price_min = $prod->price_min;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
|
||||
// multiprix
|
||||
// If price per segment
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
|
||||
{
|
||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||
@ -748,6 +748,7 @@ if (empty($reshook))
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||
@ -775,6 +776,37 @@ if (empty($reshook))
|
||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
if ($prod->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
|
||||
$pqp = GETPOST('pbq','int');
|
||||
|
||||
// Search price into product_price_by_qty from $prod->id
|
||||
foreach($prod->prices_by_qty_list[0] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
// Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
// TODO Same than PRODUIT_CUSTOMER_PRICES_BY_QTY but using $object->thirdparty->price_level
|
||||
}
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
@ -2268,12 +2300,15 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$tmparray=$object->getTotalWeightVolume();
|
||||
$totalWeight=$tmparray['weight'];
|
||||
$totalVolume=$tmparray['volume'];
|
||||
if ($totalWeight || $totalVolume)
|
||||
if ($totalWeight)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
|
||||
print '<td>';
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||
print '</td></tr>';
|
||||
}
|
||||
if ($totalVolume)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
|
||||
print '<td>';
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||
@ -2438,8 +2473,6 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
$var = true;
|
||||
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
|
||||
@ -2607,8 +2640,10 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
// Show online signature link
|
||||
// Show online payment link
|
||||
//$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
$useonlinepayment = $conf->global->ORDER_SHOW_ONLINE_PAYMENT_ON_ORDER;
|
||||
|
||||
if ($object->statut != Commande::STATUS_DRAFT && $useonlinepayment)
|
||||
{
|
||||
print '<br><!-- Link to pay -->';
|
||||
@ -2616,6 +2651,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print showOnlinePaymentUrl('order', $object->ref).'<br>';
|
||||
}
|
||||
|
||||
// Show direct download link
|
||||
if ($object->statut != Commande::STATUS_DRAFT && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD))
|
||||
{
|
||||
print '<br><!-- Link to download main doc -->'."\n";
|
||||
|
||||
@ -153,6 +153,7 @@ class Orders extends DolibarrApi
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i=0;
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -276,7 +277,7 @@ class Orders extends DolibarrApi
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$fk_parent_line,
|
||||
$request_data->fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
@ -424,14 +425,6 @@ class Orders extends DolibarrApi
|
||||
if ($this->commande->availability($this->commande->availability_id) < 0)
|
||||
throw new RestException(400, 'Error while updating availability');
|
||||
}
|
||||
// update bank account
|
||||
if(!empty($this->commande->fk_account))
|
||||
{
|
||||
if($this->commande->setBankAccount($this->commande->fk_account) == 0)
|
||||
{
|
||||
throw new RestException(400,$this->commande->error);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->commande->update(DolibarrApiAccess::$user) > 0)
|
||||
{
|
||||
@ -479,7 +472,7 @@ class Orders extends DolibarrApi
|
||||
/**
|
||||
* Validate an order
|
||||
*
|
||||
* If you get a bad value for param notrigger check that ou provide this in body
|
||||
* If you get a bad value for param notrigger check, provide this in body
|
||||
* {
|
||||
* "idwarehouse": 0,
|
||||
* "notrigger": 0
|
||||
|
||||
@ -3036,6 +3036,8 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function update(User $user, $notrigger=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
@ -3069,6 +3071,7 @@ class Commande extends CommonOrder
|
||||
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
|
||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
||||
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
|
||||
$sql.= " fk_account=".($this->fk_account>0?$this->fk_account:"null").",";
|
||||
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
||||
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
||||
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
|
||||
|
||||
@ -384,29 +384,29 @@ if ($resql)
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sall) $param.='&sall='.$sall;
|
||||
if ($socid > 0) $param.='&socid='.$socid;
|
||||
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
|
||||
if ($search_orderday) $param.='&search_orderday='.$search_orderday;
|
||||
if ($search_ordermonth) $param.='&search_ordermonth='.$search_ordermonth;
|
||||
if ($search_orderyear) $param.='&search_orderyear='.$search_orderyear;
|
||||
if ($search_deliveryday) $param.='&search_deliveryday='.$search_deliveryday;
|
||||
if ($search_deliverymonth) $param.='&search_deliverymonth='.$search_deliverymonth;
|
||||
if ($search_deliveryyear) $param.='&search_deliveryyear='.$search_deliveryyear;
|
||||
if ($search_ref) $param.='&search_ref='.$search_ref;
|
||||
if ($search_company) $param.='&search_company='.$search_company;
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".$search_project_ref;
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($billed != '') $param.='&billed='.$billed;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($sall) $param.='&sall='.urlencode($sall);
|
||||
if ($socid > 0) $param.='&socid='.urlencode($socid);
|
||||
if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut);
|
||||
if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday);
|
||||
if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth);
|
||||
if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear);
|
||||
if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday);
|
||||
if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth);
|
||||
if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_company) $param.='&search_company='.urlencode($search_company);
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($show_files) $param.='&show_files=' .urlencode($show_files);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($billed != '') $param.='&billed='.urlencode($billed);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -664,7 +664,7 @@ if ($resql)
|
||||
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||
);
|
||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Status billed
|
||||
|
||||
@ -69,14 +69,15 @@ else
|
||||
$result=restrictedArea($user,'banque');
|
||||
}
|
||||
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$description=GETPOST("description",'alpha');
|
||||
$dateop = dol_mktime(12,0,0,GETPOST("opmonth",'int'),GETPOST("opday",'int'),GETPOST("opyear",'int'));
|
||||
$debit=GETPOST("debit",'alpha');
|
||||
$credit=GETPOST("credit",'alpha');
|
||||
$type=GETPOST("type",'alpha');
|
||||
$account=GETPOST("account",'int');
|
||||
$accountancy_code=GETPOST('accountancy_code', 'alpha');
|
||||
$bid=GETPOST("bid","int");
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||
$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
|
||||
@ -85,9 +86,9 @@ $search_thirdparty=GETPOST("thirdparty",'alpha');
|
||||
$search_req_nb=GETPOST("req_nb",'alpha');
|
||||
$search_num_releve=GETPOST("search_num_releve",'alpha');
|
||||
$search_conciliated=GETPOST("search_conciliated",'int');
|
||||
$num_releve=GETPOST("num_releve");
|
||||
$num_releve=GETPOST("num_releve","alpha");
|
||||
$cat=GETPOST("cat");
|
||||
|
||||
if (empty($dateop)) $dateop=-1;
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -142,8 +143,9 @@ $arrayfields=array(
|
||||
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || ! empty($ref))?0:1), 'position'=>1000),
|
||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000),
|
||||
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
||||
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
||||
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
||||
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
|
||||
);
|
||||
// Extra fields
|
||||
@ -253,9 +255,7 @@ if (GETPOST('confirm_reconcile') && $user->rights->banque->consolidate)
|
||||
}
|
||||
|
||||
|
||||
$dateop=-1;
|
||||
|
||||
if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
||||
if (GETPOST('save') && ! $cancel && $user->rights->banque->modifier)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
@ -268,27 +268,34 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
||||
$amount = - price2num($_POST["adddebit"]);
|
||||
}
|
||||
|
||||
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
||||
$operation = GETPOST("operation",'alpha');
|
||||
$num_chq = GETPOST("num_chq",'alpha');
|
||||
$label = GETPOST("label",'alpha');
|
||||
$cat1 = GETPOST("cat1",'alpha');
|
||||
|
||||
$bankaccountid = $id;
|
||||
if (GETPOST('add_account','int') > 0) $bankaccountid = GETPOST('add_account','int');
|
||||
|
||||
if (! $dateop) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
}
|
||||
if (! $operation) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
}
|
||||
if (! $label) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Label")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
}
|
||||
if (! $amount) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||
}
|
||||
if (! $bankaccountid > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
||||
}
|
||||
/*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
|
||||
{
|
||||
@ -298,12 +305,13 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
|
||||
$objecttmp = new Account($db);
|
||||
$objecttmp->fetch($bankaccountid);
|
||||
$insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
|
||||
if ($insertid > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : ''));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -379,7 +387,7 @@ if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
|
||||
$options = array();
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
@ -390,7 +398,6 @@ if ($id > 0 || ! empty($ref))
|
||||
// Load bank groups
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||
$bankcateg = new BankCateg($db);
|
||||
$options = array();
|
||||
|
||||
foreach ($bankcateg->fetchAll() as $bankcategory) {
|
||||
$options[$bankcategory->id] = $bankcategory->label;
|
||||
@ -523,7 +530,6 @@ dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=True;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
@ -561,14 +567,12 @@ if ($resql)
|
||||
// Form to reconcile
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile')
|
||||
{
|
||||
// print '<table class="noborder" width="100%">';
|
||||
// print '<tr '.$bcnd[false].'>';
|
||||
// print '<td>';
|
||||
print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
|
||||
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
|
||||
print '<input class="flat" id="num_releve" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
|
||||
print '</div>';
|
||||
if ($options) {
|
||||
if (is_array($options) && count($options))
|
||||
{
|
||||
print $langs->trans("EventualyAddCategory").': ';
|
||||
print Form::selectarray('cat', $options, GETPOST('cat'), 1);
|
||||
}
|
||||
@ -621,7 +625,6 @@ if ($resql)
|
||||
';
|
||||
}
|
||||
print '<br><br>';
|
||||
// print '</td></tr></table>';
|
||||
}
|
||||
|
||||
// Form to add a transaction with no invoice
|
||||
@ -630,12 +633,17 @@ if ($resql)
|
||||
print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Numero").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Description").'</td>';
|
||||
//if (! $account > 0)
|
||||
//{
|
||||
print '<td align=right>'.$langs->trans("BankAccount").'</td>';
|
||||
//}
|
||||
print '<td align=right>'.$langs->trans("Debit").'</td>';
|
||||
print '<td align=right>'.$langs->trans("Credit").'</td>';
|
||||
/*if (! empty($conf->accounting->enabled))
|
||||
@ -644,33 +652,43 @@ if ($resql)
|
||||
print $langs->trans("AccountAccounting");
|
||||
print '</td>';
|
||||
}*/
|
||||
print '<td colspan="2" align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr '.$bcnd[false].'>';
|
||||
print '<td class="nowrap" colspan="2">';
|
||||
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
||||
print '</td><td>';
|
||||
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
|
||||
print '<td colspan="2">';
|
||||
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
|
||||
if ($options) {
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label","alpha").'">';
|
||||
if (is_array($options) && count($options))
|
||||
{
|
||||
print '<br>'.$langs->trans("Rubrique").': ';
|
||||
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit").'"></td>';
|
||||
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit").'"></td>';
|
||||
print '<td class="nowrap">';
|
||||
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="nowrap">';
|
||||
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq","alpha").'">';
|
||||
print '</td>';
|
||||
//if (! $account > 0)
|
||||
//{
|
||||
print '<td align=right>';
|
||||
$form->select_comptes(GETPOST('add_account','int')?GETPOST('add_account','int'):$account,'add_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||
print '</td>';
|
||||
//}
|
||||
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit","alpha").'"></td>';
|
||||
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit","alpha").'"></td>';
|
||||
/*if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||
print '</td>';
|
||||
}*/
|
||||
print '<td colspan="2" align="center">';
|
||||
print '<td align="center">';
|
||||
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
@ -710,29 +728,32 @@ if ($resql)
|
||||
$morehtml.='</div>';
|
||||
|
||||
$addbutton = '';
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
if ($action != 'addline' && $action != 'reconcile')
|
||||
{
|
||||
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
$addbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
$addbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
else // If direct entries is not done using miscellaneous payments
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
$addbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else // If direct entries is not done using miscellaneous payments
|
||||
else
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
$addbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$addbutton = '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
$morehtml.=$addbutton;
|
||||
|
||||
$picto='title_bank';
|
||||
@ -841,14 +862,21 @@ if ($resql)
|
||||
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['balancebefore']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||
print $form->textwithpicto('', $htmltext, 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||
print $form->textwithpicto('', $htmltext, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||
print $form->textwithpicto('', $htmltext, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Numero statement
|
||||
// Numero statement
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="3"></td>';
|
||||
@ -880,6 +908,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder);
|
||||
@ -905,7 +934,7 @@ if ($resql)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// If we are in a situation where we need/can show balance, we calculate the start of balance
|
||||
if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok)
|
||||
if (! $balancecalculated && (! empty($arrayfields['balancebefore']['checked']) || ! empty($arrayfields['balance']['checked'])) && $mode_balance_ok)
|
||||
{
|
||||
if (! $account)
|
||||
{
|
||||
@ -946,7 +975,7 @@ if ($resql)
|
||||
$balancefieldfound=false;
|
||||
foreach($arrayfields as $key => $val)
|
||||
{
|
||||
if ($key == 'balance')
|
||||
if ($key == 'balancebefore' || $key == 'balance')
|
||||
{
|
||||
$balancefieldfound=true;
|
||||
continue;
|
||||
@ -1260,25 +1289,46 @@ if ($resql)
|
||||
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
|
||||
}
|
||||
|
||||
// Balance before
|
||||
if (! empty($arrayfields['balancebefore']['checked']))
|
||||
{
|
||||
if ($mode_balance_ok)
|
||||
{
|
||||
$balancebefore = price2num($balance - ($sign * $objp->amount),'MT');
|
||||
if ($balancebefore >= 0)
|
||||
{
|
||||
print '<td align="right" class="nowrap"> '.price($balancebefore).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right" class="error nowrap"> '.price($balancebefore).'</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
if ($mode_balance_ok)
|
||||
{
|
||||
if ($balance >= 0)
|
||||
{
|
||||
print '<td align="right" class="nowrap"> '.price($balance).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right" class="error nowrap"> '.price($balance).'</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if ($mode_balance_ok)
|
||||
{
|
||||
if ($balance >= 0)
|
||||
{
|
||||
print '<td align="right" class="nowrap"> '.price($balance).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right" class="error nowrap"> '.price($balance).'</td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['b.num_releve']['checked']))
|
||||
|
||||
@ -2227,5 +2227,40 @@ class AccountLine extends CommonObject
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if a bank line was dispatched into bookkeeping
|
||||
*
|
||||
* @return int <0 if KO, 0=no, 1=yes
|
||||
*/
|
||||
public function getVentilExportCompta()
|
||||
{
|
||||
$alreadydispatched = 0;
|
||||
|
||||
$type = 'bank';
|
||||
|
||||
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$type."' AND ab.fk_doc = ".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$alreadydispatched = $obj->nb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($alreadydispatched)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,8 @@ class PaymentVarious extends CommonObject
|
||||
public $table_element='payment_various'; //!< Name of table without prefix where object is stored
|
||||
public $picto = 'bill';
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $tms;
|
||||
var $datep;
|
||||
var $datev;
|
||||
@ -87,8 +89,7 @@ class PaymentVarious extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
|
||||
|
||||
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
if ($this->tms) $sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql.= " sens=".$this->sens.",";
|
||||
@ -102,7 +103,6 @@ class PaymentVarious extends CommonObject
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
|
||||
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
||||
$sql.= " fk_user_modif=".$this->fk_user_modif;
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
@ -146,7 +146,6 @@ class PaymentVarious extends CommonObject
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " v.rowid,";
|
||||
|
||||
$sql.= " v.tms,";
|
||||
$sql.= " v.datep,";
|
||||
$sql.= " v.datev,";
|
||||
@ -164,7 +163,6 @@ class PaymentVarious extends CommonObject
|
||||
$sql.= " b.fk_account,";
|
||||
$sql.= " b.fk_type,";
|
||||
$sql.= " b.rappro";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql.= " WHERE v.rowid = ".$id;
|
||||
@ -184,7 +182,7 @@ class PaymentVarious extends CommonObject
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
$this->sens = $obj->sens;
|
||||
$this->amount = $obj->amount;
|
||||
$this->type_payement = $obj->fk_typepayment;
|
||||
$this->type_payment = $obj->fk_typepayment;
|
||||
$this->num_payment = $obj->num_payment;
|
||||
$this->label = $obj->label;
|
||||
$this->note = $obj->note;
|
||||
@ -350,6 +348,7 @@ class PaymentVarious extends CommonObject
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
||||
$this->ref = $this->id;
|
||||
|
||||
if ($this->id > 0)
|
||||
{
|
||||
|
||||
@ -92,11 +92,16 @@ if ($user->rights->banque->consolidate && $action == 'donext')
|
||||
|
||||
if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".GETPOST("cat1");
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$cat1=GETPOST("cat1",'int');
|
||||
if (!empty($rowid) && !empty($cat1)) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$cat1;
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
setEventMessage('Missing ids','errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->banque->modifier && $action == "update")
|
||||
@ -286,7 +291,6 @@ if ($result)
|
||||
if ($action == 'delete_categ')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$rowid."&cat1=".GETPOST("fk_categ")."&orig_account=".$orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1);
|
||||
|
||||
}
|
||||
|
||||
print '<form name="update" method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'">';
|
||||
@ -295,13 +299,14 @@ if ($result)
|
||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
||||
|
||||
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
|
||||
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), -1, 'account', 0);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($bankline, 'rowid', $linkback);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
@ -592,6 +597,8 @@ if ($result)
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -613,6 +620,8 @@ if ($result)
|
||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Conciliation")."</td>";
|
||||
@ -651,6 +660,8 @@ if ($result)
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center">';
|
||||
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
|
||||
@ -26,9 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.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.'/accountancy/class/accountingjournal.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -49,7 +49,7 @@ $sens=GETPOST("sens","int");
|
||||
$amount=GETPOST("amount");
|
||||
$paymenttype=GETPOST("paymenttype");
|
||||
$accountancy_code=GETPOST("accountancy_code","int");
|
||||
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
|
||||
$projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : GETPOST('fk_project','int'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
@ -96,22 +96,23 @@ if (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
|
||||
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
||||
$datep=dol_mktime(12,0,0, GETPOST("datepmonth",'int'), GETPOST("datepday",'int'), GETPOST("datepyear",'int'));
|
||||
$datev=dol_mktime(12,0,0, GETPOST("datevmonth",'int'), GETPOST("datevday",'int'), GETPOST("datevyear",'int'));
|
||||
if (empty($datev)) $datev=$datep;
|
||||
|
||||
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||
$object->ref=''; // TODO
|
||||
$object->accountid=GETPOST("accountid",'int') > 0 ? GETPOST("accountid","int") : 0;
|
||||
$object->datev=$datev;
|
||||
$object->datep=$datep;
|
||||
$object->amount=price2num(GETPOST("amount"));
|
||||
$object->label=GETPOST("label");
|
||||
$object->note=GETPOST("note");
|
||||
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
|
||||
$object->num_payment=GETPOST("num_payment");
|
||||
$object->amount=price2num(GETPOST("amount",'alpha'));
|
||||
$object->label=GETPOST("label",'none');
|
||||
$object->note=GETPOST("note",'none');
|
||||
$object->type_payment=GETPOST("paymenttype",'int') > 0 ? GETPOST("paymenttype", "int") : 0;
|
||||
$object->num_payment=GETPOST("num_payment",'alpha');
|
||||
$object->fk_user_author=$user->id;
|
||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
||||
$object->sens=GETPOST('sens');
|
||||
$object->fk_project= GETPOST('fk_project');
|
||||
$object->fk_project= GETPOST('fk_project','int');
|
||||
|
||||
if (empty($datep) || empty($datev))
|
||||
{
|
||||
@ -411,7 +412,7 @@ if ($id)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
|
||||
// Payment date
|
||||
print "<tr>";
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.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.'/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
$langs->loadLangs(array("compta","banks","bills","accountancy"));
|
||||
|
||||
@ -108,21 +108,19 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row
|
||||
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
|
||||
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
|
||||
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account;
|
||||
if ($search_date) $sql.=" AND v.datep=".$search_date;
|
||||
if ($search_accountancy_code) $sql.=" AND v.accountancy_code=".$search_accountancy_code;
|
||||
|
||||
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
|
||||
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
|
||||
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account;
|
||||
if ($search_date) $sql.=" AND v.datep=".$search_date;
|
||||
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code;
|
||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":","=",$filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
if ($typeid) {
|
||||
$sql .= " AND v.fk_typepayment=".$typeid;
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
@ -142,10 +140,18 @@ if ($result)
|
||||
$var=true;
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($typeid) $param.='&typeid='.$typeid;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
|
||||
//if ($search_date) $param.='&search_date='.$search_date;
|
||||
if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code);
|
||||
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
@ -162,18 +168,6 @@ if ($result)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
// Ref
|
||||
@ -205,7 +199,7 @@ if ($result)
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
if (! empty($conf->accounting->enabled))
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
@ -227,6 +221,20 @@ if ($result)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
@ -305,8 +313,9 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
|
||||
$colspan=5;
|
||||
$colspan=4;
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
if (! empty($conf->accounting->enabled)) $colspan++;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
|
||||
@ -683,7 +683,7 @@ if (empty($reshook))
|
||||
$i = 0;
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if ($line->total_ht!=0)
|
||||
if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9
|
||||
{ // no need to create discount if amount is null
|
||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||
@ -840,8 +840,8 @@ if (empty($reshook))
|
||||
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
// We do not copy the private note
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
@ -854,7 +854,7 @@ if (empty($reshook))
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
// Proprietes particulieres a facture de remplacement
|
||||
$object->fk_facture_source = $_POST['fac_replacement'];
|
||||
@ -892,8 +892,8 @@ if (empty($reshook))
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note = trim($_POST['note']);
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
// We do not copy the private note
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
@ -906,7 +906,7 @@ if (empty($reshook))
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||
@ -989,17 +989,17 @@ if (empty($reshook))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->type = $_POST['type'];
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
$object->note_private = trim(GETPOST('note_private','none'));
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
$object->fk_project = $_POST['projectid'];
|
||||
$object->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
|
||||
$object->mode_reglement_id = $_POST['mode_reglement_id'];
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
@ -1009,12 +1009,12 @@ if (empty($reshook))
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
// Source facture
|
||||
$object->fac_rec = GETPOST('fac_rec');
|
||||
$object->fac_rec = GETPOST('fac_rec', 'int');
|
||||
|
||||
$id = $object->create($user); // This include recopy of links from recurring invoice
|
||||
$id = $object->create($user); // This include recopy of links from recurring invoice and invoice lines
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,8 +1044,8 @@ if (empty($reshook))
|
||||
$object->number = $_POST['facnumber'];
|
||||
$object->date = $dateinvoice;
|
||||
$object->date_pointoftax = $date_pointoftax;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
$object->note_private = trim($_POST['note_private']);
|
||||
$object->note_public = trim(GETPOST('note_public','none'));
|
||||
$object->note_private = trim(GETPOST('note_private','none'));
|
||||
$object->ref_client = $_POST['ref_client'];
|
||||
$object->ref_int = $_POST['ref_int'];
|
||||
$object->modelpdf = $_POST['model'];
|
||||
@ -1059,7 +1059,7 @@ if (empty($reshook))
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
if (GETPOST('type') == Facture::TYPE_SITUATION)
|
||||
{
|
||||
@ -1570,7 +1570,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
|
||||
if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
$error ++;
|
||||
@ -1643,7 +1643,7 @@ if (empty($reshook))
|
||||
$price_min = $prod->price_min;
|
||||
$price_base_type = $prod->price_base_type;
|
||||
|
||||
// We define price for product
|
||||
// If price per segment
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
|
||||
{
|
||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||
@ -1657,6 +1657,7 @@ if (empty($reshook))
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||
@ -1678,6 +1679,37 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
if ($prod->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp'].
|
||||
$pqp = GETPOST('pbq','int');
|
||||
|
||||
// Search price into product_price_by_qty from $prod->id
|
||||
foreach($prod->prices_by_qty_list[0] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
// Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
// TODO Same than PRODUIT_CUSTOMER_PRICES_BY_QTY but using $object->thirdparty->price_level
|
||||
}
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
@ -1873,8 +1905,7 @@ if (empty($reshook))
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
@ -3016,10 +3047,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation de la validation
|
||||
// Confirmation of validation
|
||||
if ($action == 'valid')
|
||||
{
|
||||
// on verifie si l'objet est en numerotation provisoire
|
||||
// we check object has a draft number
|
||||
$objectref = substr($object->ref, 1, 4);
|
||||
if ($objectref == 'PROV') {
|
||||
$savdate = $object->date;
|
||||
@ -3135,7 +3166,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$i ++;
|
||||
// Texte
|
||||
$i = 0;
|
||||
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscountVat", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
|
||||
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscount", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
|
||||
$i ++;
|
||||
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
|
||||
$i ++;
|
||||
@ -3443,7 +3474,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
@ -3464,7 +3495,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateMaxPayment');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editpaymentterm&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
@ -3488,7 +3519,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
if ($action != 'editmode' && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
@ -3552,7 +3583,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||
if (($action != 'editbankaccount') && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
@ -4188,8 +4219,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
$var = true;
|
||||
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(1, $mysoc, $soc);
|
||||
|
||||
@ -4493,6 +4522,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print showOnlinePaymentUrl('invoice', $object->ref).'<br>';
|
||||
}
|
||||
|
||||
// Show direct download link
|
||||
if ($object->statut != Facture::STATUS_DRAFT && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD))
|
||||
{
|
||||
print '<br><!-- Link to download main doc -->'."\n";
|
||||
|
||||
@ -60,30 +60,30 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
function get($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
$result = $this->invoice->fetch($id);
|
||||
if (! $result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
// Get payment details
|
||||
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
|
||||
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
|
||||
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
|
||||
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
|
||||
// Get payment details
|
||||
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
|
||||
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
|
||||
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
|
||||
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||
if (! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->invoice->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List invoices
|
||||
@ -444,7 +444,7 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
|
||||
if($this->invoice->update($id, DolibarrApiAccess::$user))
|
||||
return $this->get ($id);
|
||||
return $this->get($id);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class FactureRec extends CommonInvoice
|
||||
$facsrc->lines[$i]->fk_product,
|
||||
$facsrc->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$facsrc->lines[$i]->info_bits,
|
||||
'',
|
||||
0,
|
||||
$facsrc->lines[$i]->product_type,
|
||||
@ -596,7 +596,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $fk_product Id du produit/service predefini
|
||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @param int $info_bits VAT npr or not ?
|
||||
* @param int $fk_remise_except Id remise
|
||||
* @param double $pu_ttc Prix unitaire TTC (> 0 even for credit note)
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
@ -635,7 +635,6 @@ class FactureRec extends CommonInvoice
|
||||
$remise_percent=price2num($remise_percent);
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
$qty=price2num($qty);
|
||||
if (! $info_bits) $info_bits=0;
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$txtva = price2num($txtva);
|
||||
@ -644,6 +643,7 @@ class FactureRec extends CommonInvoice
|
||||
if (empty($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
@ -703,6 +703,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", total_localtax1";
|
||||
$sql.= ", total_localtax2";
|
||||
$sql.= ", total_ttc";
|
||||
$sql.= ", info_bits";
|
||||
$sql.= ", rang";
|
||||
$sql.= ", special_code";
|
||||
$sql.= ", fk_unit";
|
||||
@ -729,6 +730,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", ".price2num($total_localtax1);
|
||||
$sql.= ", ".price2num($total_localtax2);
|
||||
$sql.= ", ".price2num($total_ttc);
|
||||
$sql.= ", ".$info_bits;
|
||||
$sql.= ", ".$rang;
|
||||
$sql.= ", ".$special_code;
|
||||
$sql.= ", ".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null");
|
||||
@ -811,7 +813,7 @@ class FactureRec extends CommonInvoice
|
||||
// Clean parameters
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
if (! $info_bits) $info_bits=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
$pu_ht=price2num($pu_ht);
|
||||
$pu_ttc=price2num($pu_ttc);
|
||||
$txtva=price2num($txtva);
|
||||
@ -884,6 +886,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||
$sql.= ", total_ttc='".price2num($total_ttc)."'";
|
||||
$sql.= ", info_bits=".$info_bits;
|
||||
$sql.= ", rang=".$rang;
|
||||
$sql.= ", special_code=".$special_code;
|
||||
$sql.= ", fk_unit=".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null");
|
||||
|
||||
@ -214,10 +214,10 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
const STATUS_ABANDONED = 3;
|
||||
|
||||
const CLOSECODE_DISCOUNTVAT = 'discount_vat';
|
||||
const CLOSECODE_BADDEBT = 'badcustomer';
|
||||
const CLOSECODE_ABANDONED = 'abandon';
|
||||
const CLOSECODE_REPLACED = 'replaced';
|
||||
const CLOSECODE_DISCOUNTVAT = 'discount_vat'; // Abandonned remain - escompte
|
||||
const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned - bad
|
||||
const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
|
||||
const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -531,6 +531,7 @@ class Facture extends CommonInvoice
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Insert lines of invoices into database
|
||||
*/
|
||||
@ -655,11 +656,20 @@ class Facture extends CommonInvoice
|
||||
$prod = new Product($this->db);
|
||||
$res=$prod->fetch($_facrec->lines[$i]->fk_product);
|
||||
}
|
||||
|
||||
// For line from template invoice, we use data from template invoice
|
||||
/*
|
||||
$tva_tx = get_default_tva($mysoc,$soc,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$soc,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr);
|
||||
*/
|
||||
$tva_tx = $_facrec->lines[$i]->tva_tx.($_facrec->lines[$i]->vat_src_code ? '('.$_facrec->lines[$i]->vat_src_code.')' : '');
|
||||
$tva_npr = $_facrec->lines[$i]->info_bits;
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx = $_facrec->lines[$i]->localtax1_tx;
|
||||
$localtax2_tx = $_facrec->lines[$i]->localtax2_tx;
|
||||
|
||||
$result_insert = $this->addline(
|
||||
$_facrec->lines[$i]->desc,
|
||||
@ -670,7 +680,11 @@ class Facture extends CommonInvoice
|
||||
$localtax2_tx,
|
||||
$_facrec->lines[$i]->fk_product,
|
||||
$_facrec->lines[$i]->remise_percent,
|
||||
'','',0,$tva_npr,'','HT',0,
|
||||
'','',0,
|
||||
$tva_npr,
|
||||
'',
|
||||
'HT',
|
||||
0,
|
||||
$_facrec->lines[$i]->product_type,
|
||||
$_facrec->lines[$i]->rang,
|
||||
$_facrec->lines[$i]->special_code,
|
||||
@ -1149,9 +1163,9 @@ class Facture extends CommonInvoice
|
||||
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
if (! empty($this->total_localtax1))
|
||||
$label.= '<br><b>' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
if (! empty($this->total_localtax2))
|
||||
$label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_ttc))
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
@ -1342,7 +1356,7 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error='Bill with id '.$rowid.' or ref '.$ref.' not found';
|
||||
$this->error='Bill with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found';
|
||||
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
|
||||
return 0;
|
||||
}
|
||||
@ -2053,11 +2067,11 @@ class Facture extends CommonInvoice
|
||||
* of no payment even if merchandises were sent).
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param string $close_code Code de fermeture
|
||||
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
|
||||
* @param string $close_note Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_canceled($user,$close_code='',$close_note='')
|
||||
function set_canceled($user, $close_code='', $close_note='')
|
||||
{
|
||||
|
||||
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
|
||||
@ -2187,7 +2201,7 @@ class Facture extends CommonInvoice
|
||||
return -12;
|
||||
}
|
||||
|
||||
$result=$facreplaced->set_canceled($user,'replaced','');
|
||||
$result=$facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, '');
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$facreplaced->error;
|
||||
|
||||
@ -789,64 +789,63 @@ if (empty($reshook))
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
|
||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
|
||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
||||
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
|
||||
$objectline = new FactureLigneRec($db);
|
||||
if ($objectline->fetch(GETPOST('lineid')))
|
||||
$objectline = new FactureLigneRec($db);
|
||||
if ($objectline->fetch(GETPOST('lineid')))
|
||||
{
|
||||
$objectline->array_options=$array_options;
|
||||
$result=$objectline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$objectline->array_options=$array_options;
|
||||
$result=$objectline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($langs->trans('Error').$result, null, 'errors');
|
||||
}
|
||||
setEventMessages($langs->trans('Error').$result, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value)
|
||||
{
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value)
|
||||
{
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code=GETPOST('special_code');
|
||||
if (! GETPOST('qty')) $special_code=3;
|
||||
// Define special_code for special lines
|
||||
$special_code=GETPOST('special_code');
|
||||
if (! GETPOST('qty')) $special_code=3;
|
||||
|
||||
/*$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
/*$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
$percent = $line->get_prev_progress($object->id);
|
||||
|
||||
if (GETPOST('progress') < $percent)
|
||||
{
|
||||
if (GETPOST('progress') < $percent)
|
||||
{
|
||||
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$error++;
|
||||
$result = -1;
|
||||
}*/
|
||||
}*/
|
||||
|
||||
// Check minimum price
|
||||
$productid = GETPOST('productid', 'int');
|
||||
if (! empty($productid))
|
||||
{
|
||||
// Check minimum price
|
||||
$productid = GETPOST('productid', 'int');
|
||||
if (! empty($productid))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($productid);
|
||||
|
||||
@ -854,18 +853,19 @@ if (empty($reshook))
|
||||
|
||||
$price_min = $product->price_min;
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
|
||||
$price_min = $product->multiprices_min [$object->thirdparty->price_level];
|
||||
$price_min = $product->multiprices_min[$object->thirdparty->price_level];
|
||||
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
|
||||
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))
|
||||
{
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
|
||||
// Check parameters
|
||||
if (GETPOST('type') < 0) {
|
||||
@ -873,39 +873,39 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
if ($qty < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
if ($qty < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
// Update line
|
||||
if (! $error)
|
||||
// Update line
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->updateline(
|
||||
GETPOST('lineid'),
|
||||
$description,
|
||||
$pu_ht,
|
||||
$qty,
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax1_rate,
|
||||
GETPOST('productid'),
|
||||
GETPOST('remise_percent'),
|
||||
'HT',
|
||||
$info_bits,
|
||||
0,
|
||||
0,
|
||||
$type,
|
||||
0,
|
||||
$special_code,
|
||||
$label,
|
||||
GETPOST('units'),
|
||||
$pu_ht_devise
|
||||
);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result = $object->updateline(
|
||||
GETPOST('lineid'),
|
||||
$description,
|
||||
$pu_ht,
|
||||
$qty,
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax1_rate,
|
||||
GETPOST('productid'),
|
||||
GETPOST('remise_percent'),
|
||||
'HT',
|
||||
$info_bits,
|
||||
0,
|
||||
0,
|
||||
$type,
|
||||
0,
|
||||
$special_code,
|
||||
$label,
|
||||
GETPOST('units'),
|
||||
$pu_ht_devise
|
||||
);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
@ -1056,7 +1056,7 @@ if ($action == 'create')
|
||||
print '<td class="tdtop">';
|
||||
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic');
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
@ -1067,7 +1067,7 @@ if ($action == 'create')
|
||||
print '<td class="tdtop">';
|
||||
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate');
|
||||
print '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
|
||||
@ -1299,13 +1299,13 @@ else
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Author").'</td><td>'.$author->getFullName($langs)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td colspan="3">'.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '<td>'.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td colspan="3">'.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
@ -1332,7 +1332,7 @@ else
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if ($action == 'editconditions')
|
||||
@ -1356,7 +1356,7 @@ else
|
||||
if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode')
|
||||
{
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
|
||||
@ -1396,16 +1396,16 @@ else
|
||||
// Note public
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60');
|
||||
print '</td><td class="wordbreak">';
|
||||
print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Note private
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $user->rights->facture->creer);
|
||||
print '</td><td colspan="5">';
|
||||
print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60');
|
||||
print '</td><td class="wordbreak">';
|
||||
print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1419,7 +1419,7 @@ else
|
||||
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount')
|
||||
{
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
@ -1441,7 +1441,7 @@ else
|
||||
if (($action != 'editmodelpdf') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmodelpdf&id='.$object->id.'">'.img_edit($langs->trans('SetModel'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmodelpdf')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
|
||||
@ -359,9 +359,10 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
$sql.= ' f.datec as date_creation, f.tms as date_update,';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= " country.code as country_code";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
@ -484,8 +485,10 @@ if (! $sall)
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' f.datec, f.tms,';
|
||||
$sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,';
|
||||
$sql.= ' state.code_departement, state.nom';
|
||||
$sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
||||
$sql.= ' typent.code,';
|
||||
$sql.= ' state.code_departement, state.nom,';
|
||||
$sql.= ' country.code';
|
||||
|
||||
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
|
||||
{
|
||||
@ -681,6 +684,10 @@ if ($resql)
|
||||
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
||||
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
||||
);
|
||||
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
|
||||
}
|
||||
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
|
||||
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
|
||||
print '</td>';
|
||||
@ -874,6 +881,17 @@ if ($resql)
|
||||
$facturestatic->note_public=$obj->note_public;
|
||||
$facturestatic->note_private=$obj->note_private;
|
||||
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=$obj->client;
|
||||
$thirdpartystatic->fournisseur=$obj->fournisseur;
|
||||
$thirdpartystatic->code_client=$obj->code_client;
|
||||
$thirdpartystatic->code_compta_client=$obj->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur=$obj->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur=$obj->code_compta_fournisseur;
|
||||
$thirdpartystatic->email=$obj->email;
|
||||
$thirdpartystatic->country_code=$obj->country_code;
|
||||
|
||||
$paiement = $facturestatic->getSommePaiement();
|
||||
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
|
||||
$totaldeposits = $facturestatic->getSumDepositsUsed();
|
||||
@ -962,11 +980,6 @@ if ($resql)
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">';
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=$obj->client;
|
||||
$thirdpartystatic->code_client=$obj->code_client;
|
||||
$thirdpartystatic->email=$obj->email;
|
||||
print $thirdpartystatic->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -516,20 +516,16 @@ if ($object->id > 0)
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
$numopen = 0; $numclosed = 0;
|
||||
$numopen = 0; $pending = 0; $numclosed = 0;
|
||||
|
||||
/*
|
||||
* Withdrawal opened requests
|
||||
*/
|
||||
|
||||
// How many Direct debit opened requests ?
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
|
||||
$sql .= " , pfd.date_traite as date_traite";
|
||||
$sql .= " , pfd.amount";
|
||||
$sql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE fk_facture = ".$object->id;
|
||||
$sql .= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
@ -539,11 +535,34 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($result_sql);
|
||||
$numopen = $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// For wich amount ?
|
||||
|
||||
$sql = "SELECT SUM(pfd.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " WHERE fk_facture = ".$object->id;
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
if ($result_sql)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
if ($obj) $pending = $obj->amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
// Add a transfer request
|
||||
@ -553,11 +572,13 @@ if ($object->id > 0)
|
||||
{
|
||||
if ($user->rights->prelevement->bons->creer)
|
||||
{
|
||||
$remaintopaylesspendingdebit = $resteapayer - $pending;
|
||||
|
||||
print '<form method="POST" action="">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '" />';
|
||||
print '<input type="hidden" name="action" value="new" />';
|
||||
print '<label for="withdraw_request_amount">' . $langs->trans('WithdrawRequestAmount') . ' </label>';
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="' . $resteapayer . '" size="10" />';
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="' . $remaintopaylesspendingdebit . '" size="10" />';
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
|
||||
print '</form>';
|
||||
}
|
||||
@ -604,10 +625,24 @@ if ($object->id > 0)
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
|
||||
$sql.= " , pfd.date_traite as date_traite, pfd.amount,";
|
||||
$sql.= " u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
|
||||
$sql.= " WHERE fk_facture = ".$object->id;
|
||||
$sql.= " AND pfd.traite = 0";
|
||||
$sql.= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
|
||||
$num = 0;
|
||||
if ($result_sql)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
@ -637,18 +672,16 @@ if ($object->id > 0)
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Closed requests
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande,";
|
||||
$sql.= " pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
|
||||
// Past requests
|
||||
|
||||
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
|
||||
$sql.= " pb.ref,";
|
||||
$sql.= " u.rowid as user_id, u.lastname, u.firstname, u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_bons as pb,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
|
||||
$sql.= " WHERE fk_facture = ".$object->id;
|
||||
$sql.= " AND pfd.fk_user_demande = u.rowid";
|
||||
$sql.= " AND pb.rowid = pfd.fk_prelevement_bons";
|
||||
$sql.= " AND pfd.traite = 1";
|
||||
$sql.= " ORDER BY pfd.date_demande DESC";
|
||||
|
||||
@ -672,10 +705,13 @@ if ($object->id > 0)
|
||||
print '<td align="center">'.price($obj->amount).'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
$withdrawreceipt=new BonPrelevement($db);
|
||||
$withdrawreceipt->id=$obj->fk_prelevement_bons;
|
||||
$withdrawreceipt->ref=$obj->ref;
|
||||
print $withdrawreceipt->getNomUrl(1);
|
||||
if ($obj->fk_prelevement_bons > 0)
|
||||
{
|
||||
$withdrawreceipt=new BonPrelevement($db);
|
||||
$withdrawreceipt->id=$obj->fk_prelevement_bons;
|
||||
$withdrawreceipt->ref=$obj->ref;
|
||||
print $withdrawreceipt->getNomUrl(1);
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
print '<td> </td>';
|
||||
|
||||
@ -63,6 +63,7 @@ if ($user->societe_id > 0)
|
||||
|
||||
$max=3;
|
||||
|
||||
$hookmanager->initHooks(array('invoiceindex'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -139,8 +140,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
|
||||
$sql.= ", f.type";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ",s.code_client";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
$sql.= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -152,6 +153,10 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerDraft',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -172,22 +177,28 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->ref_client=$obj->ref_client;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->ref_client=$obj->ref_client;
|
||||
$facturestatic->type=$obj->type;
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->email=$obj->email;
|
||||
$companystatic->client = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td>';
|
||||
@ -221,15 +232,18 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
{
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierDraft',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
@ -248,22 +262,28 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
|
||||
$facturesupplierstatic->ref=$obj->ref;
|
||||
$facturesupplierstatic->id=$obj->rowid;
|
||||
$facturesupplierstatic->total_ht=$obj->total_ht;
|
||||
$facturesupplierstatic->total_tva=$obj->total_tva;
|
||||
$facturesupplierstatic->total_ttc=$obj->total_ttc;
|
||||
$facturesupplierstatic->ref_supplier=$obj->ref_supplier;
|
||||
$facturesupplierstatic->total_ht=$obj->total_ht;
|
||||
$facturesupplierstatic->total_tva=$obj->total_tva;
|
||||
$facturesupplierstatic->total_ttc=$obj->total_ttc;
|
||||
$facturesupplierstatic->ref_supplier=$obj->ref_supplier;
|
||||
$facturesupplierstatic->type=$obj->type;
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->email=$obj->email;
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
print $facturesupplierstatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1,'supplier',16);
|
||||
print '</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
@ -303,7 +323,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.code_client, s.code_compta";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
@ -312,7 +332,13 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta";
|
||||
$sql.= " ORDER BY f.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -337,19 +363,28 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
$facturestatic->type=$obj->type;
|
||||
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=1;
|
||||
$thirdpartystatic->code_client = $obj->code_client;
|
||||
//$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$thirdpartystatic->code_compta = $obj->code_compta;
|
||||
//$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
@ -366,12 +401,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=1;
|
||||
$thirdpartystatic->code_client = $obj->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $thirdpartystatic->getNomUrl(1,'customer',44);
|
||||
print $thirdpartystatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
@ -412,7 +442,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql.= ", SUM(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
@ -421,7 +451,13 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid, s.code_fournisseur";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierLastModified',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql.= " ORDER BY ff.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -445,20 +481,25 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
$facstatic->ref=$obj->ref;
|
||||
$facstatic->id = $obj->rowid;
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$facstatic->id = $obj->rowid;
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->fournisseur=1;
|
||||
$thirdpartystatic->code_client = $obj->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
//$thirdpartystatic->code_client = $obj->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
//$thirdpartystatic->code_compta = $obj->code_compta;
|
||||
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $thirdpartystatic->getNomUrl(1,'supplier',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
@ -500,6 +541,11 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
||||
$sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " WHERE d.entity IN (".getEntity('donation').")";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereLastDonations',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order("d.tms","DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -575,6 +621,11 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$sql.= " WHERE c.fk_type = cc.id";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.paye = 0";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereSocialContributions',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY c.rowid, c.amount, c.date_ech, c.paye, cc.libelle";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -645,9 +696,9 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.nom as name, s.email";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.code_client, s.code_compta";
|
||||
$sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -660,7 +711,12 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
$sql.= " AND c.fk_statut = 3";
|
||||
$sql.= " AND c.facture = 0";
|
||||
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ( $resql )
|
||||
@ -679,18 +735,28 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
print '<th align="right">'.$langs->trans("ToBill").'</th>';
|
||||
print '<th align="center" width="16"> </th>';
|
||||
print '</tr>';
|
||||
|
||||
$tot_ht=$tot_ttc=$tot_tobill=0;
|
||||
$societestatic = new Societe($db);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->email=$obj->email;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
//$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$societestatic->code_compta = $obj->code_compta;
|
||||
//$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
|
||||
$commandestatic->id=$obj->rowid;
|
||||
$commandestatic->ref=$obj->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
print $commandestatic->getNomUrl(1);
|
||||
@ -708,11 +774,6 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
@ -754,8 +815,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
$sql.= ", s.code_client, s.code_compta";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
@ -764,7 +825,13 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta";
|
||||
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -791,19 +858,29 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->type=$obj->type;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->email=$obj->email;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$societestatic->code_compta = $obj->code_compta;
|
||||
$societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->type=$obj->type;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
@ -820,11 +897,6 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left">' ;
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->datelimite),'day').'</td>';
|
||||
@ -874,9 +946,9 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
|
||||
$sql.= ", ff.date_lim_reglement";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", s.rowid as socid, s.email";
|
||||
$sql.= ", s.code_client, s.code_compta";
|
||||
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
@ -887,8 +959,13 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierUnpaid',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye, ff.date_lim_reglement,";
|
||||
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||
$sql.= " ORDER BY ff.date_lim_reglement ASC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
@ -915,19 +992,25 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
$facstatic->ref=$obj->ref;
|
||||
$facstatic->id = $obj->rowid;
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->email=$obj->email;
|
||||
$societestatic->client=0;
|
||||
$societestatic->fournisseur=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
$societestatic->code_compta = $obj->code_compta;
|
||||
$societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->client=0;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->date_lim_reglement),'day').'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
|
||||
@ -257,7 +257,7 @@ if (empty($reshook))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
|
||||
@ -141,13 +141,13 @@ class Paiement extends CommonObject
|
||||
/**
|
||||
* Create payment of invoices into database.
|
||||
* Use this->amounts to have list of invoices for the payment.
|
||||
* For payment of a customer invoice, amounts are postive, for payment of credit note, amounts are negative
|
||||
* For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
|
||||
* @return int id of created payment, < 0 if error
|
||||
*/
|
||||
function create($user,$closepaidinvoices=0)
|
||||
function create($user, $closepaidinvoices=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -190,6 +190,7 @@ class Paiement extends CommonObject
|
||||
// Check parameters
|
||||
if (empty($totalamount) && empty($atleastonepaymentnotnull)) // We accept negative amounts for withdraw reject but not empty arrays
|
||||
{
|
||||
$this->errors[]='TotalAmountEmpty';
|
||||
$this->error='TotalAmountEmpty';
|
||||
return -1;
|
||||
}
|
||||
@ -232,11 +233,12 @@ class Paiement extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$invoice=new Facture($this->db);
|
||||
$invoice->fetch($facid);
|
||||
|
||||
// If we want to closed payed invoices
|
||||
if ($closepaidinvoices)
|
||||
{
|
||||
$invoice=new Facture($this->db);
|
||||
$invoice->fetch($facid);
|
||||
$paiement = $invoice->getSommePaiement();
|
||||
$creditnotes=$invoice->getSumCreditNotesUsed();
|
||||
$deposits=$invoice->getSumDepositsUsed();
|
||||
@ -337,26 +339,25 @@ class Paiement extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $invoice->fetch($id); // Reload to get new records
|
||||
|
||||
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
|
||||
if ($result < 0) {
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Regenerate documents of invoices
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $invoice->fetch($facid); // Reload to get new records
|
||||
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
|
||||
if ($result < 0) {
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1133,4 +1134,29 @@ class Paiement extends CommonObject
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the third party of object, from id into this->thirdparty
|
||||
*
|
||||
* @param int $force_thirdparty_id Force thirdparty id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_thirdparty($force_thirdparty_id=0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
if (empty($force_thirdparty_id))
|
||||
{
|
||||
$billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first supplier invoice to get him
|
||||
if (!empty($billsarray))
|
||||
{
|
||||
$invoice = new Facture($this->db);
|
||||
if ($invoice->fetch($billsarray[0]) > 0)
|
||||
{
|
||||
$force_thirdparty_id = $invoice->fk_soc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::fetch_thirdparty($force_thirdparty_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,13 +240,13 @@ if ($id > 0 || $ref)
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="infotrans">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
|
||||
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransData").'</td><td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TransData").'</td><td>';
|
||||
print $form->select_date('','','','','',"userfile",1,1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||
print $form->selectarray("methode",$object->methodes_trans);
|
||||
print '</td></tr>';
|
||||
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
|
||||
@ -256,6 +256,7 @@ if ($id > 0 || $ref)
|
||||
print '</table><br>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("SetToStatusSent")).'"></div>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if (! empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
|
||||
@ -263,16 +264,17 @@ if ($id > 0 || $ref)
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="infocredit">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
|
||||
print '<tr '.$bc[false].'><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans('CreditDate').'</td><td>';
|
||||
print $form->select_date('','','','','',"infocredit",1,1);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<br>'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice");
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("ClassCredited")).'"></div>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -519,6 +519,9 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->date_credit = $date;
|
||||
$this->statut = 1;
|
||||
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
@ -584,13 +587,16 @@ class BonPrelevement extends CommonObject
|
||||
// TODO Call trigger to create a notification using notification module
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->date_trans = $date;
|
||||
$this->statut = 1;
|
||||
$this->db->commit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -849,15 +855,22 @@ class BonPrelevement extends CommonObject
|
||||
foreach ($factures as $key => $fac)
|
||||
{
|
||||
$fact = new Facture($this->db);
|
||||
if ($fact->fetch($fac[0]) >= 0) // Field 0 of $fac is rowid of invoice
|
||||
$resfetch = $fact->fetch($fac[0]);
|
||||
if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice
|
||||
{
|
||||
if ($soc->fetch($fact->socid) >= 0)
|
||||
{
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0, $soc->id);
|
||||
|
||||
if ($format == 'FRST' && $bac->frstrecur != 'FRST') continue;
|
||||
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) continue;
|
||||
if ($format == 'FRST' && $bac->frstrecur != 'FRST')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($bac->verif() >= 1)
|
||||
{
|
||||
@ -865,28 +878,29 @@ class BonPrelevement extends CommonObject
|
||||
/* second tableau necessaire pour BonPrelevement */
|
||||
$factures_prev_id[$i] = $fac[0];
|
||||
$i++;
|
||||
//dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
|
||||
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
|
||||
$this->invoice_in_error[$fac[0]]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||
$this->thirdparty_in_error[$soc->id]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_ERR);
|
||||
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_ERR);
|
||||
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_ERR);
|
||||
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -236,10 +236,10 @@ class RejetPrelevement
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
|
||||
$subject = $langs->trans("InfoRejectSubject");
|
||||
$subject = $langs->transnoentities("InfoRejectSubject");
|
||||
$sendto = $emuser->getFullName($langs)." <".$emuser->email.">";
|
||||
$from = $this->user->getFullName($langs)." <".$this->user->email.">";
|
||||
$msgishtml=0;
|
||||
$msgishtml=1;
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
|
||||
@ -72,8 +72,7 @@ if ($action == 'create')
|
||||
}
|
||||
elseif ($result == 0)
|
||||
{
|
||||
$mesg='';
|
||||
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
|
||||
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format);
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
$mesg.='<br>'."\n";
|
||||
foreach($bprev->invoice_in_error as $key => $val)
|
||||
|
||||
@ -159,7 +159,7 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
if (! empty($conf->accounting->enabled)) $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year']-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year']+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesResultDue");
|
||||
@ -173,7 +173,7 @@ elseif ($modecompta=="RECETTES-DEPENSES")
|
||||
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
if (! empty($conf->accounting->enabled)) $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
//$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1);
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year']-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year']+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
|
||||
@ -121,7 +121,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
if (! empty($conf->accounting->enabled)) $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesAmountWithTaxIncluded");
|
||||
@ -135,7 +135,7 @@ else if ($modecompta=="RECETTES-DEPENSES") {
|
||||
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
if (! empty($conf->accounting->enabled)) $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesAmountWithTaxIncluded");
|
||||
|
||||
@ -169,7 +169,7 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
$name=$langs->trans("AnnualByAccountDueDebtMode");
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
if (! empty($conf->accounting->enabled)) $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
$description=$langs->trans("RulesResultDue");
|
||||
@ -182,7 +182,7 @@ else if ($modecompta=="RECETTES-DEPENSES") {
|
||||
$name=$langs->trans("AnnualByAccountInputOutputMode");
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
if (! empty($conf->accounting->enabled)) $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||
//$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1);
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
|
||||
@ -161,6 +161,7 @@ if ($object->id)
|
||||
|
||||
$modulepart = 'tax';
|
||||
$permission = $user->rights->tax->charges->creer;
|
||||
$permtoedit = $user->rights->fournisseur->facture->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("accountancy");
|
||||
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
// Security check
|
||||
|
||||
@ -82,13 +82,13 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$object->datev=$datev;
|
||||
$object->datep=$datep;
|
||||
|
||||
$amount = price2num(GETPOST("amount"));
|
||||
$amount = price2num(GETPOST("amount",'alpha'));
|
||||
if ($refund == 1) {
|
||||
$amount= -$amount;
|
||||
}
|
||||
$object->amount= $amount;
|
||||
$object->label=GETPOST("label");
|
||||
$object->note=GETPOST("note");
|
||||
$object->label=GETPOST("label",'alpha');
|
||||
$object->note=GETPOST("note",'none');
|
||||
|
||||
if (empty($object->datev))
|
||||
{
|
||||
@ -304,7 +304,7 @@ if ($id)
|
||||
{
|
||||
$head=vat_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
|
||||
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), -1, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/reglement.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -100,9 +101,7 @@ class Tva extends CommonObject
|
||||
$sql.= "fk_bank,";
|
||||
$sql.= "fk_user_creat,";
|
||||
$sql.= "fk_user_modif";
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " '".$this->db->idate($now)."',";
|
||||
$sql.= " '".$this->db->idate($this->datep)."',";
|
||||
$sql.= " '".$this->db->idate($this->datev)."',";
|
||||
@ -112,7 +111,6 @@ class Tva extends CommonObject
|
||||
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->db->escape($this->fk_bank)."'").",";
|
||||
$sql.= " '".$this->db->escape($this->fk_user_creat)."',";
|
||||
$sql.= " '".$this->db->escape($this->fk_user_modif)."'";
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -496,6 +494,7 @@ class Tva extends CommonObject
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
if (empty($this->datec)) $this->datec = dol_now();
|
||||
|
||||
// Check parameters
|
||||
if (! $this->label)
|
||||
@ -520,8 +519,10 @@ class Tva extends CommonObject
|
||||
}
|
||||
|
||||
// Insert into llx_tva
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep";
|
||||
$sql.= ", datev";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (";
|
||||
$sql.= "datec";
|
||||
$sql.= ", datep";
|
||||
$sql.= ", datev";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", fk_typepayment";
|
||||
$sql.= ", num_payment";
|
||||
@ -532,7 +533,8 @@ class Tva extends CommonObject
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->db->idate($this->datep)."'";
|
||||
$sql.= " '".$this->db->idate($this->datec)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datep)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql.= ", ".$this->amount;
|
||||
$sql.= ", '".$this->db->escape($this->type_payment)."'";
|
||||
@ -650,25 +652,76 @@ class Tva extends CommonObject
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option link option
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string Chaine with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
function getNomUrl($withpicto=0, $option='', $notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
$url = DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id;
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowMyObject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend ='</a>';
|
||||
|
||||
$picto='payment';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount of payments already done
|
||||
*
|
||||
* @return int Amount of payment already done, <0 if KO
|
||||
*/
|
||||
function getSommePaiement()
|
||||
{
|
||||
$table='paiementcharge';
|
||||
$field='fk_charge';
|
||||
|
||||
$sql = 'SELECT sum(amount) as amount';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$table;
|
||||
$sql.= ' WHERE '.$field.' = '.$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$amount=0;
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $amount=$obj->amount?$obj->amount:0;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Informations of vat payment object
|
||||
@ -678,7 +731,7 @@ class Tva extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.tms, t.datec, t.fk_user_creat";
|
||||
$sql = "SELECT t.rowid, t.tms, t.fk_user_modif, t.datec, t.fk_user_creat";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
|
||||
177
htdocs/compta/tva/document.php
Normal file
177
htdocs/compta/tva/document.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/tva/document.php
|
||||
* \ingroup tax
|
||||
* \brief Page with attached files on social contributions
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("companies");
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', $id, 'vat','charges');
|
||||
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new Tva($db);
|
||||
if ($id > 0) $object->fetch($id);
|
||||
|
||||
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='tax';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
$title = $langs->trans("VATPayment") . ' - ' . $langs->trans("Documents");
|
||||
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
||||
llxHeader("",$title,$help_url);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$alreadypayed=$object->getSommePaiement();
|
||||
|
||||
$head=vat_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("VATPayment"), -1, 'bill');
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' : ';
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/index.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// Construit liste des fichiers
|
||||
$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)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'tax';
|
||||
$permission = $user->rights->tax->charges->creer;
|
||||
$permtoedit = $user->rights->fournisseur->facture->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -51,7 +51,7 @@ $object->info($id);
|
||||
|
||||
$head = vat_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment');
|
||||
dol_fiche_head($head, 'info', $langs->trans("VATPayment"), -1, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/reglement.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user