Merge branch 'develop' into new_order_min_amount
This commit is contained in:
commit
475b89bac1
340
ChangeLog
340
ChangeLog
@ -2,54 +2,267 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** 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: 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
|
||||
|
||||
***** 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 *****
|
||||
|
||||
WARNING:
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
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:
|
||||
@ -75,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
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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,27 +96,32 @@ $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'))
|
||||
{
|
||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$query .= " where date_start < now() and date_end > 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');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
if (empty($search_date_start) && empty($search_date_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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +129,7 @@ if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !
|
||||
$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),
|
||||
@ -433,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);
|
||||
@ -579,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";
|
||||
|
||||
@ -680,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']++;
|
||||
}
|
||||
|
||||
@ -707,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++;
|
||||
|
||||
@ -68,7 +68,7 @@ $pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "t.rowid";
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
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);
|
||||
@ -81,6 +81,7 @@ if (empty($search_date_start)) {
|
||||
} 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)
|
||||
@ -225,14 +226,13 @@ 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>';
|
||||
|
||||
$param=$options;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -82,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;
|
||||
@ -135,7 +135,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -781,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 ();
|
||||
@ -849,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 .= " ) ";
|
||||
|
||||
|
||||
@ -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
|
||||
@ -271,7 +271,8 @@ if ($result) {
|
||||
|
||||
if ($links[$key]['type'] == 'payment') {
|
||||
$paymentstatic->id = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
|
||||
$paymentstatic->ref = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
|
||||
$tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id;
|
||||
} else if ($links[$key]['type'] == 'payment_supplier') {
|
||||
$paymentsupplierstatic->id = $links[$key]['url_id'];
|
||||
@ -303,6 +304,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 ";
|
||||
@ -319,11 +321,12 @@ if ($result) {
|
||||
}
|
||||
} else if ($links[$key]['type'] == 'payment_donation') {
|
||||
$paymentdonstatic->id = $links[$key]['url_id'];
|
||||
$paymentdonstatic->ref = $links[$key]['url_id'];
|
||||
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
||||
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'payment_vat') {
|
||||
} else if ($links[$key]['type'] == 'payment_vat') { // Payment VAT
|
||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||
$paymentvatstatic->label = $links[$key]['label'];
|
||||
@ -401,7 +404,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 +428,13 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
// Line into bank account
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
if ($mt) {
|
||||
if ($mt)
|
||||
{
|
||||
$reflabel = '';
|
||||
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
||||
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($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 +453,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 +479,155 @@ 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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
|
||||
$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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
||||
$reflabel.= dol_string_nohtmltag('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 +697,105 @@ 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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
||||
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
|
||||
$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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
|
||||
$reflabel.= dol_string_nohtmltag('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 +901,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 +910,56 @@ 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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
|
||||
$reflabel.= $langs->trans("Bank").' '.$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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":"");
|
||||
$reflabel.= $val['soclib'];
|
||||
|
||||
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
print "<td></td>";
|
||||
@ -974,42 +1022,49 @@ 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 = '';
|
||||
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
|
||||
$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 +1144,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 +1163,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 +1191,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>';
|
||||
|
||||
|
||||
@ -709,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("");
|
||||
|
||||
@ -643,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("");
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
@ -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";
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -145,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);
|
||||
|
||||
@ -217,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')
|
||||
@ -229,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);
|
||||
|
||||
@ -31,7 +31,7 @@ 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
|
||||
@ -103,93 +103,147 @@ 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"; // Required so later we can use the parameter $previoushash of checkSignature()
|
||||
$previoushash='';
|
||||
$firstid='';
|
||||
|
||||
$res = $db->query($sql);
|
||||
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('Status')
|
||||
.';'.$langs->transnoentities('FullData')
|
||||
."\n";
|
||||
|
||||
$previoushash = '';
|
||||
$loweridinerror = 0;
|
||||
|
||||
while ($obj = $db->fetch_object($res))
|
||||
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)
|
||||
{
|
||||
// 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);
|
||||
$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);
|
||||
|
||||
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
|
||||
$res = $db->query($sql);
|
||||
if($res)
|
||||
{
|
||||
// Make the first fetch to get first line
|
||||
$obj = $db->fetch_object($res);
|
||||
|
||||
if ($checksignature)
|
||||
{
|
||||
if ($loweridinerror > 0) $statusofrecord = 'ValidButFoundAPreviousKO';
|
||||
else $statusofrecord = 'Valid';
|
||||
}
|
||||
else
|
||||
{
|
||||
$statusofrecord = 'KO';
|
||||
$loweridinerror = $obj->rowid;
|
||||
}
|
||||
$previoushash = $block_static->getPreviousHash(0, $obj->rowid);
|
||||
$firstid = $obj->rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
.';"'.str_replace('"','""',$obj->object_data).'"'
|
||||
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";
|
||||
|
||||
// Set new previous hash for next fetch
|
||||
$previoushash = $obj->signature;
|
||||
}
|
||||
$loweridinerror = 0;
|
||||
$i = 0;
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($db->lasterror, 'errors');
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,18 +316,22 @@ if (GETPOST('withtab','alpha')) $param.='&withtab='.urlencode(GETPOST('withtab',
|
||||
// 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&search_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">';
|
||||
@ -301,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
|
||||
@ -330,6 +389,9 @@ $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
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -349,6 +411,7 @@ print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"],'',''
|
||||
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>';
|
||||
|
||||
@ -386,35 +449,49 @@ if (is_array($blocks))
|
||||
{
|
||||
$object_link = $block->getObjectLink();
|
||||
|
||||
if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
|
||||
//if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
|
||||
if (empty($search_showonlyerrors) || ! $checkresult[$block->id])
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// ID
|
||||
print '<td>'.$block->id.'</td>';
|
||||
|
||||
// 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);
|
||||
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'), 'statut1');
|
||||
if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut4');
|
||||
else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
||||
}
|
||||
else
|
||||
@ -422,10 +499,19 @@ if (is_array($blocks))
|
||||
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>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
@ -437,12 +523,11 @@ if (is_array($blocks))
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Javascript to manage the showinfo popup
|
||||
print '<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
@ -454,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;
|
||||
}
|
||||
|
||||
@ -149,11 +149,10 @@ 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';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,6 +217,17 @@ class BlockedLog
|
||||
$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';
|
||||
|
||||
@ -299,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;
|
||||
}
|
||||
@ -363,9 +373,27 @@ 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','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;
|
||||
@ -376,28 +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)
|
||||
{
|
||||
@ -421,26 +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;
|
||||
@ -463,21 +511,25 @@ 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;
|
||||
@ -724,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
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -220,7 +220,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");
|
||||
@ -229,7 +229,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);
|
||||
|
||||
@ -792,7 +792,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last sendings
|
||||
* Last shipments
|
||||
*/
|
||||
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
|
||||
$sendingstatic = new Expedition($db);
|
||||
@ -1264,7 +1264,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);
|
||||
@ -1290,7 +1290,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";
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
@ -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);
|
||||
@ -552,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>';
|
||||
@ -563,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>';
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -2130,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))
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -2300,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');
|
||||
|
||||
@ -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").",";
|
||||
|
||||
@ -387,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))
|
||||
{
|
||||
@ -398,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;
|
||||
@ -531,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();
|
||||
@ -569,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);
|
||||
}
|
||||
@ -629,7 +625,6 @@ if ($resql)
|
||||
';
|
||||
}
|
||||
print '<br><br>';
|
||||
// print '</td></tr></table>';
|
||||
}
|
||||
|
||||
// Form to add a transaction with no invoice
|
||||
@ -663,7 +658,8 @@ if ($resql)
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label","alpha").'">';
|
||||
if (is_array($options) && count($options)) {
|
||||
if (is_array($options) && count($options))
|
||||
{
|
||||
print '<br>'.$langs->trans("Rubrique").': ';
|
||||
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -291,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.'">';
|
||||
@ -300,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%">';
|
||||
@ -597,6 +597,8 @@ if ($result)
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -618,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>";
|
||||
@ -656,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").'">';
|
||||
|
||||
@ -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>";
|
||||
|
||||
@ -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
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -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;
|
||||
@ -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 ++;
|
||||
@ -3047,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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1163,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);
|
||||
|
||||
@ -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>
|
||||
@ -1396,7 +1396,7 @@ 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>';
|
||||
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>';
|
||||
@ -1404,7 +1404,7 @@ else
|
||||
// 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>';
|
||||
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>';
|
||||
|
||||
@ -140,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";
|
||||
@ -177,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>';
|
||||
@ -226,8 +232,8 @@ 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";
|
||||
@ -256,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>';
|
||||
@ -311,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";
|
||||
@ -325,7 +337,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$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, s.nom, s.rowid, s.code_client";
|
||||
$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);
|
||||
|
||||
@ -350,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">';
|
||||
@ -379,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>';
|
||||
@ -425,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";
|
||||
@ -439,7 +456,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$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, s.nom, s.rowid, s.code_fournisseur";
|
||||
$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);
|
||||
|
||||
@ -463,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>';
|
||||
@ -673,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";
|
||||
@ -693,7 +716,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill',$parameters);
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$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";
|
||||
$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 )
|
||||
@ -712,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);
|
||||
@ -741,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>';
|
||||
@ -787,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";
|
||||
@ -802,7 +830,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$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, s.nom, s.rowid, s.code_client";
|
||||
$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);
|
||||
@ -829,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">';
|
||||
@ -858,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>';
|
||||
@ -912,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";
|
||||
@ -930,8 +964,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$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,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
|
||||
$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);
|
||||
@ -958,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,7 +141,7 @@ 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
|
||||
@ -233,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();
|
||||
@ -338,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
|
||||
{
|
||||
@ -1042,12 +1042,15 @@ class Paiement extends CommonObject
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @param string $option Sur quoi pointe le lien
|
||||
* @param string $mode 'withlistofinvoices'=Include list of invoices into tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$mode='withlistofinvoices')
|
||||
function getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result='';
|
||||
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
||||
if ($mode == 'withlistofinvoices')
|
||||
@ -1064,12 +1067,31 @@ class Paiement extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
$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.'"':'');
|
||||
|
||||
$url = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id;
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.($this->ref?$this->ref:$this->id).$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 && $withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
@ -651,26 +652,79 @@ 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;
|
||||
global $langs, $conf;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$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
|
||||
*
|
||||
|
||||
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();
|
||||
@ -97,7 +97,7 @@ $formother=new FormOther($db);
|
||||
$tva_static = new Tva($db);
|
||||
$bankstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
|
||||
$sql = "SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")";
|
||||
@ -192,8 +192,8 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DateValue",$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DateValue",$_SERVER["PHP_SELF"],"t.datev","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"t.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@ -217,10 +217,13 @@ if ($result)
|
||||
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
|
||||
// Ref
|
||||
print "<td>".$tva_static->getNomUrl(1)."</td>\n";
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dv),'day')."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
// Label
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datev),'day')."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
// Type
|
||||
print $type;
|
||||
// Account
|
||||
|
||||
@ -607,7 +607,15 @@ else
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
|
||||
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
|
||||
{
|
||||
print '<tr><td><label for="state_id">'.$langs->trans('Region-State').'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
|
||||
}
|
||||
|
||||
if ($object->country_id)
|
||||
{
|
||||
print $formcompany->select_state(GETPOST("state_id",'alpha')?GETPOST("state_id",'alpha'):$object->state_id,$object->country_code,'state_id');
|
||||
@ -852,7 +860,15 @@ else
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
||||
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2))
|
||||
{
|
||||
print '<tr><td><label for="state_id">'.$langs->trans('Region-State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
||||
}
|
||||
|
||||
print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id,'state_id');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -42,6 +42,27 @@ class Contact extends CommonObject
|
||||
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
public $picto = 'contact';
|
||||
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
|
||||
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
|
||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
|
||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
|
||||
);
|
||||
|
||||
public $civility_id; // In fact we store civility_code
|
||||
public $civility_code;
|
||||
public $address;
|
||||
@ -96,9 +117,15 @@ class Contact extends CommonObject
|
||||
public $user_id;
|
||||
public $user_login;
|
||||
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
public $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -131,7 +158,7 @@ class Contact extends CommonObject
|
||||
$sql.= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')';
|
||||
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')';
|
||||
$sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
|
||||
if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -657,43 +657,53 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
$action = 'editline';
|
||||
$_GET['rowid'] = GETPOST('elrowid');
|
||||
$error++;
|
||||
}
|
||||
$error = 0;
|
||||
|
||||
if (!$error) {
|
||||
$objectline = new ContratLigne($db);
|
||||
if ($objectline->fetch(GETPOST('elrowid')))
|
||||
{
|
||||
$db->begin();
|
||||
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
|
||||
{
|
||||
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
|
||||
$action = 'editline';
|
||||
$_GET['rowid'] = GETPOST('elrowid');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
|
||||
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
|
||||
if (! $error)
|
||||
{
|
||||
$objectline = new ContratLigne($db);
|
||||
if ($objectline->fetch(GETPOST('elrowid')) < 0)
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$vat_rate = GETPOST('eltva_tx');
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
|
||||
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
|
||||
|
||||
$vat_rate = GETPOST('eltva_tx');
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
$info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
|
||||
$txtva = $vat_rate;
|
||||
$txtva = $vat_rate;
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
}
|
||||
|
||||
// ajout prix d'achat
|
||||
$fk_fournprice = $_POST['fournprice'];
|
||||
@ -704,22 +714,22 @@ if (empty($reshook))
|
||||
|
||||
$fk_unit = GETPOST('unit', 'alpha');
|
||||
|
||||
$objectline->description=GETPOST('product_desc','none');
|
||||
$objectline->price_ht=GETPOST('elprice');
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
$objectline->qty=GETPOST('elqty');
|
||||
$objectline->remise_percent=GETPOST('elremise_percent');
|
||||
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
|
||||
$objectline->vat_src_code=$vat_src_code;
|
||||
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
|
||||
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
|
||||
$objectline->date_ouverture_prevue=$date_start_update;
|
||||
$objectline->date_ouverture=$date_start_real_update;
|
||||
$objectline->date_fin_validite=$date_end_update;
|
||||
$objectline->date_cloture=$date_end_real_update;
|
||||
$objectline->fk_user_cloture=$user->id;
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
$objectline->description=GETPOST('product_desc','none');
|
||||
$objectline->price_ht=GETPOST('elprice');
|
||||
$objectline->subprice=GETPOST('elprice');
|
||||
$objectline->qty=GETPOST('elqty');
|
||||
$objectline->remise_percent=GETPOST('elremise_percent');
|
||||
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
|
||||
$objectline->vat_src_code=$vat_src_code;
|
||||
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
|
||||
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
|
||||
$objectline->date_ouverture_prevue=$date_start_update;
|
||||
$objectline->date_ouverture=$date_start_real_update;
|
||||
$objectline->date_fin_validite=$date_end_update;
|
||||
$objectline->date_cloture=$date_end_real_update;
|
||||
$objectline->fk_user_cloture=$user->id;
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
|
||||
if ($fk_unit > 0) {
|
||||
$objectline->fk_unit = GETPOST('unit');
|
||||
@ -727,30 +737,30 @@ if (empty($reshook))
|
||||
$objectline->fk_unit = null;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
$objectline->array_options=$array_options;
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
$objectline->array_options=$array_options;
|
||||
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
|
||||
$result=$objectline->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$objectline->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($objectline->error, $objectline->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
@ -771,6 +781,30 @@ if (empty($reshook))
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$result = $object->validate($user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'reopen' && $user->rights->contrat->creer)
|
||||
|
||||
@ -386,7 +386,11 @@ class Contrat extends CommonObject
|
||||
$result=$this->thirdparty->set_as_client();
|
||||
|
||||
// Define new ref
|
||||
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
|
||||
if ($force_number)
|
||||
{
|
||||
$num = $force_number;
|
||||
}
|
||||
else if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
|
||||
{
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
}
|
||||
@ -1264,26 +1268,14 @@ class Contrat extends CommonObject
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
// Call triggers
|
||||
$result=$this->call_trigger('CONTRACT_MODIFY',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
@ -2868,6 +2860,9 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$this->oldcopy = new ContratLigne($this->db);
|
||||
$this->oldcopy->fetch($this->id);
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
$sql.= " fk_contrat=".$this->fk_contrat.",";
|
||||
@ -2907,22 +2902,14 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$contrat=new Contrat($this->db);
|
||||
$contrat->fetch($this->fk_contrat);
|
||||
$result=$contrat->update_statut($user);
|
||||
}
|
||||
else
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
//return -1;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -2930,19 +2917,52 @@ class ContratLigne extends CommonObjectLine
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (! $notrigger)
|
||||
// If we change a planned date (start or end), sync dates for all services
|
||||
if (! $error && ! empty($conf->global->CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES))
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
}
|
||||
if ($this->date_ouverture_prevue != $this->oldcopy->date_ouverture_prevue)
|
||||
{
|
||||
$sql ='UPDATE '.MAIN_DB_PREFIX.'contratdet SET';
|
||||
$sql.= " date_ouverture_prevue = ".($this->date_ouverture_prevue!=''?"'".$this->db->idate($this->date_ouverture_prevue)."'":"null");
|
||||
$sql.= " WHERE fk_contrat = ".$this->fk_contrat;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
if ($this->date_fin_validite != $this->oldcopy->date_fin_validite)
|
||||
{
|
||||
$sql ='UPDATE '.MAIN_DB_PREFIX.'contratdet SET';
|
||||
$sql.= " date_fin_validite = ".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null");
|
||||
$sql.= " WHERE fk_contrat = ".$this->fk_contrat;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_UPDATE', $user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
$this->errors[]=$this->error;
|
||||
|
||||
@ -33,14 +33,14 @@ if (GETPOST('formfilteraction') == 'listafterchangingselectedfields')
|
||||
$tabparam=array();
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
|
||||
|
||||
if (GETPOST("selectedfields")) $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=GETPOST("selectedfields");
|
||||
else $tabparam["MAIN_SELECTEDFIELDS_".$varpage]='';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
|
||||
$result=dol_set_user_param($db, $conf, $user, $tabparam);
|
||||
|
||||
|
||||
//$action='list';
|
||||
//var_dump($tabparam);exit;
|
||||
}
|
||||
|
||||
@ -40,7 +40,13 @@ if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtas
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($object->error) && ! count($object->errors)) setEventMessages('Fetch on object return an error without filling $object->error nor $object->errors', null, 'errors');
|
||||
if (empty($object->error) && ! count($object->errors))
|
||||
{
|
||||
if ($ret < 0) // if $ret == 0, it means not found.
|
||||
{
|
||||
setEventMessages('Fetch on object (type '.get_class($object).') return an error without filling $object->error nor $object->errors', null, 'errors');
|
||||
}
|
||||
}
|
||||
else setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
@ -102,10 +102,10 @@ if (GETPOST('removAll','alpha'))
|
||||
*/
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
|
||||
{
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
if (empty($trackid)) $trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
$subject='';$actionmsg='';$actionmsg2='';
|
||||
|
||||
if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail");
|
||||
$langs->load('mails');
|
||||
|
||||
if (is_object($object))
|
||||
@ -320,6 +320,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
|
||||
// Feature to push mail sent into Sent folder
|
||||
/* This code must be now included into the hook mail, method sendMailAfter
|
||||
if (! empty($conf->dolimail->enabled))
|
||||
{
|
||||
$mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
|
||||
@ -328,7 +329,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
$mbid = $mailfromid[1];
|
||||
|
||||
/*IMAP Postbox*/
|
||||
// IMAP Postbox
|
||||
$mailboxconfig = new IMAP($db);
|
||||
$mailboxconfig->fetch($mbid);
|
||||
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
|
||||
@ -360,6 +361,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
|
||||
@ -392,7 +394,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
// FIXME This must be moved into the trigger for action $trigger_name
|
||||
// Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
|
||||
/*
|
||||
if (! empty($conf->dolimail->enabled))
|
||||
{
|
||||
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
|
||||
@ -410,7 +413,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Initialisation of datas
|
||||
if (is_object($object))
|
||||
@ -445,12 +448,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
// This avoid sending mail twice if going out and then back to page
|
||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||
setEventMessages($mesg, null, 'mesgs');
|
||||
if ($conf->dolimail->enabled)
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
|
||||
exit;
|
||||
}
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:''));
|
||||
|
||||
$moreparam='';
|
||||
if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
||||
@ -59,7 +59,7 @@ if (empty($img))
|
||||
}
|
||||
|
||||
// Define mime type
|
||||
top_httphead('image/png');
|
||||
top_httphead('image/png', 1);
|
||||
|
||||
$background_color = imagecolorallocate($img, 250, 250, 250);
|
||||
$ecriture_color = imagecolorallocate($img, 0, 0, 0);
|
||||
|
||||
@ -84,7 +84,7 @@ class box_produits extends ModeleBoxes
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||
// Add where from hooks
|
||||
|
||||
@ -88,7 +88,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
|
||||
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||
|
||||
@ -108,7 +108,7 @@ class CMailFile
|
||||
* @param string $css Css option
|
||||
* @param string $trackid Tracking string (contains type and id of related element)
|
||||
* @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment)
|
||||
* @param string $sendcontext 'standard', 'emailing', ...
|
||||
* @param string $sendcontext 'standard', 'emailing', ... (used to define with sending mode and parameters to use)
|
||||
*/
|
||||
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='',$sendcontext='standard')
|
||||
{
|
||||
@ -482,7 +482,7 @@ class CMailFile
|
||||
|
||||
|
||||
/**
|
||||
* Send mail that was prepared by constructor
|
||||
* Send mail that was prepared by constructor.
|
||||
*
|
||||
* @return boolean True if mail sent, false otherwise
|
||||
*/
|
||||
@ -495,19 +495,25 @@ class CMailFile
|
||||
|
||||
$res=false;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
|
||||
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array('maildao'));
|
||||
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (! empty($reshook))
|
||||
$hookmanager->initHooks(array('mail'));
|
||||
|
||||
$parameters=array(); $action='';
|
||||
$reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0)
|
||||
{
|
||||
$this->error = "Error in hook maildao doactions " . $reshook;
|
||||
$this->error = "Error in hook maildao sendMail " . $reshook;
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
|
||||
|
||||
return $reshook;
|
||||
}
|
||||
if ($reshook == 1) // Hook replace standard code
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
|
||||
@ -557,6 +563,12 @@ class CMailFile
|
||||
$keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING';
|
||||
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
|
||||
}
|
||||
|
||||
if(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
|
||||
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||
$this->addr_cc = '';
|
||||
$this->addr_bcc = '';
|
||||
}
|
||||
|
||||
// Action according to choosed sending method
|
||||
if ($this->sendmode == 'mail')
|
||||
@ -760,13 +772,21 @@ class CMailFile
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Send mail method not correctly defined
|
||||
// --------------------------------------
|
||||
|
||||
return 'Bad value for sendmode';
|
||||
}
|
||||
|
||||
$parameters=array(); $action='';
|
||||
$reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0)
|
||||
{
|
||||
$this->error = "Error in hook maildao sendMailAfter " . $reshook;
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
|
||||
|
||||
return $reshook;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -338,7 +338,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, 0=no, 1=yes
|
||||
*/
|
||||
function getVentilExportCompta()
|
||||
public function getVentilExportCompta()
|
||||
{
|
||||
$alreadydispatched = 0;
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
|
||||
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frederic France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -78,7 +79,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public $array_options=array();
|
||||
/**
|
||||
* @var int[] Array of linked objects ids. Loaded by ->fetchObjectLinked
|
||||
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
|
||||
*/
|
||||
public $linkedObjectsIds;
|
||||
/**
|
||||
@ -1273,14 +1274,15 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object from specific field
|
||||
*
|
||||
* @param string $table Table element or element line
|
||||
* @param string $field Field selected
|
||||
* @param string $key Import key
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetchObjectFrom($table,$field,$key)
|
||||
* Load object from specific field
|
||||
*
|
||||
* @param string $table Table element or element line
|
||||
* @param string $field Field selected
|
||||
* @param string $key Import key
|
||||
* @param string $element Element name
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetchObjectFrom($table, $field, $key, $element = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1288,7 +1290,11 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE ".$field." = '".$key."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
if (! empty($element)) {
|
||||
$sql.= " AND entity IN (".getEntity($element).")";
|
||||
} else {
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1340,6 +1346,7 @@ abstract class CommonObject
|
||||
* @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none'
|
||||
* @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see updateExtraField
|
||||
*/
|
||||
function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='')
|
||||
{
|
||||
@ -1789,29 +1796,57 @@ abstract class CommonObject
|
||||
* Change the shipping method
|
||||
*
|
||||
* @param int $shipping_method_id Id of shipping method
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @param User $userused Object user
|
||||
*
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function setShippingMethod($shipping_method_id)
|
||||
function setShippingMethod($shipping_method_id, $notrigger=false, $userused=null)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (empty($userused)) $userused=$user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setShippingMethod was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($shipping_method_id<0) $shipping_method_id='NULL';
|
||||
dol_syslog(get_class($this).'::setShippingMethod('.$shipping_method_id.')');
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET fk_shipping_method = ".$shipping_method_id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
|
||||
return 1;
|
||||
} else {
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
dol_syslog(get_class($this).'::setShippingMethod Error ', LOG_DEBUG);
|
||||
$this->error=$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
} else {
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$this->context=array('shippingmethodupdate'=>1);
|
||||
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
|
||||
if ($result < 0) $error++;
|
||||
// End call trigger
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
} else {
|
||||
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1887,14 +1922,24 @@ abstract class CommonObject
|
||||
* Change the bank account
|
||||
*
|
||||
* @param int $fk_account Id of bank account
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @param User $userused Object user
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function setBankAccount($fk_account)
|
||||
function setBankAccount($fk_account, $notrigger=false, $userused=null)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (empty($userused)) $userused=$user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->begin();
|
||||
|
||||
if ($fk_account<0) $fk_account='NULL';
|
||||
dol_syslog(get_class($this).'::setBankAccount('.$fk_account.')');
|
||||
|
||||
@ -1902,15 +1947,37 @@ abstract class CommonObject
|
||||
$sql.= " SET fk_account = ".$fk_account;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
$this->fk_account = ($fk_account=='NULL')?null:$fk_account;
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$this->context=array('bankaccountupdate'=>1);
|
||||
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
|
||||
if ($result < 0) $error++;
|
||||
// End call trigger
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->fk_account = ($fk_account=='NULL')?null:$fk_account;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Move line related operations to CommonObjectLine?
|
||||
|
||||
@ -4391,7 +4458,7 @@ abstract class CommonObject
|
||||
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
|
||||
* @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
|
||||
*/
|
||||
function fetch_optionals($rowid=null,$optionsArray=null)
|
||||
function fetch_optionals($rowid=null, $optionsArray=null)
|
||||
{
|
||||
if (empty($rowid)) $rowid=$this->id;
|
||||
|
||||
@ -4506,8 +4573,9 @@ abstract class CommonObject
|
||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
||||
* @param User $userused Object user
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
* @see updateExtraField, setValueFrom
|
||||
*/
|
||||
function insertExtraFields($trigger='',$userused=null)
|
||||
function insertExtraFields($trigger='', $userused=null)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
@ -4536,16 +4604,30 @@ abstract class CommonObject
|
||||
|
||||
foreach($new_array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
$attributeType = $extrafields->attribute_type[$attributeKey];
|
||||
$attributeLabel = $extrafields->attribute_label[$attributeKey];
|
||||
$attributeParam = $extrafields->attribute_param[$attributeKey];
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
$attributeType = $extrafields->attribute_type[$attributeKey];
|
||||
$attributeLabel = $extrafields->attribute_label[$attributeKey];
|
||||
$attributeParam = $extrafields->attribute_param[$attributeKey];
|
||||
$attributeRequired = $extrafields->attribute_required[$attributeKey];
|
||||
|
||||
if ($attributeRequired)
|
||||
{
|
||||
$mandatorypb=false;
|
||||
if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb=true;
|
||||
if ($this->array_options[$key] === '') $mandatorypb=true;
|
||||
if ($mandatorypb)
|
||||
{
|
||||
$this->errors[]=$langs->trans('ErrorFieldRequired', $attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($attributeType)
|
||||
{
|
||||
case 'int':
|
||||
if (!is_numeric($value) && $value!='')
|
||||
{
|
||||
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
|
||||
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
elseif ($value=='')
|
||||
@ -4569,23 +4651,27 @@ abstract class CommonObject
|
||||
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
|
||||
break;
|
||||
case 'link':
|
||||
$param_list=array_keys($attributeParam ['options']);
|
||||
$param_list=array_keys($attributeParam['options']);
|
||||
// 0 : ObjectName
|
||||
// 1 : classPath
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
|
||||
{
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if ($value)
|
||||
if ($value == '-1') // -1 is key for no defined in combo list of objects
|
||||
{
|
||||
$new_array_options[$key]='';
|
||||
}
|
||||
elseif ($value)
|
||||
{
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if (is_numeric($value)) $res=$object->fetch($value);
|
||||
else $res=$object->fetch('',$value);
|
||||
|
||||
if ($res > 0) $new_array_options[$key]=$object->id;
|
||||
else
|
||||
{
|
||||
$this->error="Ref '".$value."' for object '".$object->element."' not found";
|
||||
$this->error="Id/Ref '".$value."' for object '".$object->element."' not found";
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -4598,6 +4684,7 @@ abstract class CommonObject
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$table_element = $this->table_element;
|
||||
@ -4642,16 +4729,14 @@ abstract class CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
|
||||
if (! $error && $trigger)
|
||||
{
|
||||
if ($trigger)
|
||||
{
|
||||
// Call trigger
|
||||
$this->context=array('extrafieldaddupdate'=>1);
|
||||
$result=$this->call_trigger($trigger, $userused);
|
||||
if ($result < 0) $error++;
|
||||
// End call trigger
|
||||
}
|
||||
// Call trigger
|
||||
$this->context=array('extrafieldaddupdate'=>1);
|
||||
$result=$this->call_trigger($trigger, $userused);
|
||||
if ($result < 0) $error++;
|
||||
// End call trigger
|
||||
}
|
||||
|
||||
if ($error)
|
||||
@ -4670,15 +4755,19 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* Update an exta field value for the current object.
|
||||
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* This function delte record with all extrafields and insert them again from the array $this->array_options.
|
||||
* Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
*
|
||||
* @param string $key Key of the extrafield
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
* @param string $key Key of the extrafield
|
||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
||||
* @param User $userused Object user
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
* @see setValueFrom
|
||||
*/
|
||||
function updateExtraField($key)
|
||||
function updateExtraField($key, $trigger, $userused)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs,$user;
|
||||
|
||||
if (empty($userused)) $userused=$user;
|
||||
|
||||
$error=0;
|
||||
|
||||
@ -4730,9 +4819,9 @@ abstract class CommonObject
|
||||
// 1 : classPath
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if ($value)
|
||||
{
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
$object->fetch(0,$value);
|
||||
$this->array_options["options_".$key]=$object->id;
|
||||
}
|
||||
@ -4745,7 +4834,21 @@ abstract class CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error && $trigger)
|
||||
{
|
||||
// Call trigger
|
||||
$this->context=array('extrafieldupdate'=>1);
|
||||
$result=$this->call_trigger($trigger, $userused);
|
||||
if ($result < 0) $error++;
|
||||
// End call trigger
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -5849,7 +5952,7 @@ abstract class CommonObject
|
||||
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
|
||||
* @param string[] $tables Tables that need to be changed
|
||||
* @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
|
||||
* @return bool
|
||||
* @return bool True if success, False if error
|
||||
*/
|
||||
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
|
||||
{
|
||||
@ -6254,12 +6357,14 @@ abstract class CommonObject
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
}
|
||||
|
||||
// Create extrafields
|
||||
if (! $error)
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
// Triggers
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call triggers
|
||||
@ -6321,13 +6426,13 @@ abstract class CommonObject
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateCommon(User $user, $notrigger = false)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -6375,7 +6480,22 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger) {
|
||||
// Update extrafield
|
||||
if (! $error)
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Triggers
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call triggers
|
||||
$result=$this->call_trigger(strtoupper(get_class($this)).'_MODIFY',$user);
|
||||
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
||||
@ -6414,6 +6534,19 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element."_extrafields";
|
||||
$sql.= " WHERE fk_object=" . $this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
|
||||
|
||||
@ -259,9 +259,6 @@ class Conf
|
||||
// Load translation object with current language
|
||||
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
|
||||
|
||||
//if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1;
|
||||
//if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1;
|
||||
|
||||
$rootfordata = DOL_DATA_ROOT;
|
||||
$rootforuser = DOL_DATA_ROOT;
|
||||
// If multicompany module is enabled, we redefine the root of data
|
||||
|
||||
@ -594,7 +594,7 @@ class DolGraph
|
||||
* @param string $fileurl Url path to show image if saved onto disk
|
||||
* @return integer|null
|
||||
*/
|
||||
function draw($file,$fileurl='')
|
||||
function draw($file, $fileurl='')
|
||||
{
|
||||
if (empty($file))
|
||||
{
|
||||
@ -602,12 +602,17 @@ class DolGraph
|
||||
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
if (! is_array($this->data) || count($this->data) < 1)
|
||||
if (! is_array($this->data))
|
||||
{
|
||||
$this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters";
|
||||
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (count($this->data) < 1)
|
||||
{
|
||||
$this->error="Call to draw method was made but SetData was is an empty dataset";
|
||||
dol_syslog(get_class($this)."::draw ".$this->error, LOG_WARNING);
|
||||
}
|
||||
$call = "draw_".$this->_library;
|
||||
call_user_func_array(array($this,$call), array($file,$fileurl));
|
||||
}
|
||||
@ -822,7 +827,7 @@ class DolGraph
|
||||
|
||||
$legends=array();
|
||||
$nblot=count($this->data[0])-1; // -1 to remove legend
|
||||
if ($nblot < 0) dol_print_error('', 'Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw');
|
||||
if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING);
|
||||
$firstlot=0;
|
||||
// Works with line but not with bars
|
||||
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
|
||||
|
||||
@ -111,6 +111,9 @@ class ExtraFields
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->error = array();
|
||||
$this->attributes = array();
|
||||
|
||||
// For old usage
|
||||
$this->attribute_elementtype = array();
|
||||
$this->attribute_type = array();
|
||||
$this->attribute_label = array();
|
||||
@ -140,15 +143,15 @@ class ExtraFields
|
||||
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Visibilty
|
||||
* @param int $ishidden Deprecated. Use visibility instead.
|
||||
* @param int $list Visibilty (0=never visible, 1=visible on list+forms, 2=list onyl, 3=form only)
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields (for multicompany modules)
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=-1, $ishidden=0, $computed='', $entity='', $langfile='', $enabled='1')
|
||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=-1, $notused=0, $computed='', $entity='', $langfile='', $enabled='1')
|
||||
{
|
||||
if (empty($attrname)) return -1;
|
||||
if (empty($label)) return -1;
|
||||
@ -165,7 +168,7 @@ class ExtraFields
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
||||
{
|
||||
// Add declaration of field into table
|
||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden, $default, $computed, $entity, $langfile, $enabled);
|
||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $notused, $default_value, $computed, $entity, $langfile, $enabled);
|
||||
$err2=$this->errno;
|
||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
|
||||
{
|
||||
@ -282,7 +285,7 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Visibily
|
||||
* @param int $ishidden Deprecated. Use visibility instead.
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
@ -290,7 +293,7 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=-1, $ishidden=0, $default='', $computed='',$entity='', $langfile='', $enabled='1')
|
||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=-1, $notused=0, $default='', $computed='',$entity='', $langfile='', $enabled='1')
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
@ -306,9 +309,9 @@ class ExtraFields
|
||||
|
||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
|
||||
{
|
||||
if(is_array($param) && count($param) > 0)
|
||||
if (is_array($param) && count($param) > 0)
|
||||
{
|
||||
$params = $this->db->escape(serialize($param));
|
||||
$params = serialize($param);
|
||||
}
|
||||
elseif (strlen($param) > 0)
|
||||
{
|
||||
@ -490,7 +493,7 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Visibility
|
||||
* @param int $ishidden Deprecated. Use visiblity instead.
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
@ -498,7 +501,7 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int >0 if OK, <=0 if KO
|
||||
*/
|
||||
function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $ishidden=0, $default='', $computed='', $entity='', $langfile='', $enabled='1')
|
||||
function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $notused=0, $default='', $computed='', $entity='', $langfile='', $enabled='1')
|
||||
{
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||
@ -546,7 +549,7 @@ class ExtraFields
|
||||
{
|
||||
if ($label)
|
||||
{
|
||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden,$default,$computed,$entity,$langfile,$enabled);
|
||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$notused,$default,$computed,$entity,$langfile,$enabled);
|
||||
}
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -597,7 +600,7 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Visiblity
|
||||
* @param int $ishidden Deprecated. Use visility instead.
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
@ -605,10 +608,10 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0,$default='',$computed='',$entity='',$langfile='',$enabled='1')
|
||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$notused=0,$default='',$computed='',$entity='',$langfile='',$enabled='1')
|
||||
{
|
||||
global $conf, $user;
|
||||
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled);
|
||||
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$notused.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled);
|
||||
|
||||
// Clean parameters
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
@ -624,10 +627,17 @@ class ExtraFields
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
if (is_array($param))
|
||||
if (is_array($param) && count($param) > 0)
|
||||
{
|
||||
if (count($param) > 0) $param = $this->db->escape(serialize($param));
|
||||
else $param='';
|
||||
$params = serialize($param);
|
||||
}
|
||||
elseif (strlen($param) > 0)
|
||||
{
|
||||
$params = trim($param);
|
||||
}
|
||||
else
|
||||
{
|
||||
$params='';
|
||||
}
|
||||
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
@ -671,7 +681,7 @@ class ExtraFields
|
||||
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
|
||||
$sql.= " ".$pos.",";
|
||||
$sql.= " '".$this->db->escape($alwayseditable)."',";
|
||||
$sql.= " '".$this->db->escape($param)."',";
|
||||
$sql.= " '".$this->db->escape($params)."',";
|
||||
$sql.= " ".$list.", ";
|
||||
$sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
|
||||
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
|
||||
@ -1341,28 +1351,48 @@ class ExtraFields
|
||||
/**
|
||||
* Return HTML string to put an output field into a page
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show
|
||||
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
|
||||
* @return string Formated value
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show
|
||||
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
|
||||
* @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data
|
||||
* @return string Formated value
|
||||
*/
|
||||
function showOutputField($key,$value,$moreparam='')
|
||||
function showOutputField($key, $value, $moreparam='', $extrafieldsobjectkey='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$elementtype=$this->attribute_elementtype[$key]; // seems not used
|
||||
$label=$this->attribute_label[$key];
|
||||
$type=$this->attribute_type[$key];
|
||||
$size=$this->attribute_size[$key];
|
||||
$default=$this->attribute_default[$key];
|
||||
$computed=$this->attribute_computed[$key];
|
||||
$unique=$this->attribute_unique[$key];
|
||||
$required=$this->attribute_required[$key];
|
||||
$param=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$langfile=$this->attribute_langfile[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
if (! empty($extrafieldsobjectkey))
|
||||
{
|
||||
$elementtype=$this->attributes[$extrafieldsobjectkey]['elementtype'][$key]; // seems not used
|
||||
$label=$this->attributes[$extrafieldsobjectkey]['label'][$key];
|
||||
$type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||
$size=$this->attributes[$extrafieldsobjectkey]['size'][$key];
|
||||
$default=$this->attributes[$extrafieldsobjectkey]['default'][$key];
|
||||
$computed=$this->attributes[$extrafieldsobjectkey]['computed'][$key];
|
||||
$unique=$this->attributes[$extrafieldsobjectkey]['unique'][$key];
|
||||
$required=$this->attributes[$extrafieldsobjectkey]['required'][$key];
|
||||
$param=$this->attributes[$extrafieldsobjectkey]['param'][$key];
|
||||
$perms=$this->attributes[$extrafieldsobjectkey]['perms'][$key];
|
||||
$langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key];
|
||||
$list=$this->attributes[$extrafieldsobjectkey]['list'][$key];
|
||||
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
else
|
||||
{
|
||||
$elementtype=$this->attribute_elementtype[$key]; // seems not used
|
||||
$label=$this->attribute_label[$key];
|
||||
$type=$this->attribute_type[$key];
|
||||
$size=$this->attribute_size[$key];
|
||||
$default=$this->attribute_default[$key];
|
||||
$computed=$this->attribute_computed[$key];
|
||||
$unique=$this->attribute_unique[$key];
|
||||
$required=$this->attribute_required[$key];
|
||||
$param=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$langfile=$this->attribute_langfile[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
|
||||
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
|
||||
|
||||
@ -1590,8 +1620,9 @@ class ExtraFields
|
||||
elseif ($type == 'link')
|
||||
{
|
||||
$out='';
|
||||
// only if something to display (perf)
|
||||
if ($value)
|
||||
|
||||
// Only if something to display (perf)
|
||||
if ($value) // If we have -1 here, pb is into sert, not into ouptu
|
||||
{
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
|
||||
@ -1638,14 +1669,16 @@ class ExtraFields
|
||||
/**
|
||||
* Return tag to describe alignement to use for this extrafield
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @return string Formated value
|
||||
* @param string $key Key of attribute
|
||||
* @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data
|
||||
* @return string Formated value
|
||||
*/
|
||||
function getAlignFlag($key)
|
||||
function getAlignFlag($key, $extrafieldsobjectkey='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$type=$this->attribute_type[$key];
|
||||
if (! empty($extrafieldsobjectkey)) $type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
|
||||
else $type=$this->attribute_type[$key];
|
||||
|
||||
$align='';
|
||||
|
||||
|
||||
@ -139,6 +139,9 @@ class HookManager
|
||||
'addMoreMassActions',
|
||||
'addSearchEntry',
|
||||
'addStatisticLine',
|
||||
'createDictionaryFieldList',
|
||||
'editDictionaryFieldlist',
|
||||
'getFormMail',
|
||||
'deleteFile',
|
||||
'doActions',
|
||||
'doMassActions',
|
||||
@ -175,10 +178,9 @@ class HookManager
|
||||
'formatEvent',
|
||||
'printObjectLine',
|
||||
'printObjectSubLine',
|
||||
'createDictionaryFieldList',
|
||||
'editDictionaryFieldlist',
|
||||
'getFormMail',
|
||||
'showLinkToObjectBlock'
|
||||
'showLinkToObjectBlock',
|
||||
'sendMail',
|
||||
'sendMailAfter'
|
||||
)
|
||||
)) $hooktype='addreplace';
|
||||
|
||||
|
||||
@ -1726,7 +1726,7 @@ class Form
|
||||
* @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
|
||||
* @param int $limit Limit on number of returned lines
|
||||
* @param int $price_level Level of price to show
|
||||
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
|
||||
* @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell
|
||||
* @param int $finished 2=all, 1=finished, 0=raw material
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
|
||||
@ -1740,7 +1740,7 @@ class Form
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
|
||||
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
|
||||
* @return void
|
||||
*/
|
||||
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array())
|
||||
@ -2390,7 +2390,7 @@ class Form
|
||||
* Return list of suppliers products
|
||||
*
|
||||
* @param int $socid Id societe fournisseur (0 pour aucun filtre)
|
||||
* @param int $selected Produit pre-selectionne
|
||||
* @param int $selected Product price pre-selected (must be 'id' in product_fournisseur_price or 'idprod_IDPROD')
|
||||
* @param string $htmlname Nom de la zone select
|
||||
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
|
||||
* @param string $filtre Pour filtre sql
|
||||
@ -5275,7 +5275,7 @@ class Form
|
||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
$fieldstoshow='t.ref';
|
||||
if (! empty($objecttmp->fields))
|
||||
if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...)
|
||||
{
|
||||
$tmpfieldstoshow='';
|
||||
foreach($objecttmp->fields as $key => $val)
|
||||
@ -6252,8 +6252,11 @@ class Form
|
||||
$navurl = preg_replace('/\/tasks\/(task|contact|time|note|document)\.php/','/tasks.php',$navurl);
|
||||
$paramid='ref';
|
||||
}
|
||||
$previous_ref = $object->ref_previous?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>':'<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
|
||||
$next_ref = $object->ref_next?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>':'<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
|
||||
|
||||
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
|
||||
// accesskey is for Mac: CTRL + key for all browsers
|
||||
$previous_ref = $object->ref_previous?'<a accesskey="p" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>':'<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
|
||||
$next_ref = $object->ref_next?'<a accesskey="n" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>':'<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
|
||||
}
|
||||
|
||||
//print "xx".$previous_ref."x".$next_ref;
|
||||
|
||||
@ -266,10 +266,10 @@ class FormCompany
|
||||
$out.= '<option value="'.$obj->rowid.'">';
|
||||
}
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE) && $conf->global->MAIN_SHOW_REGION_IN_STATE == 2) {
|
||||
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2) {
|
||||
$out.= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
|
||||
}
|
||||
else if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE) && $conf->global->MAIN_SHOW_REGION_IN_STATE == 1) {
|
||||
else if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
|
||||
$out.= $obj->region_name . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
|
||||
}
|
||||
else {
|
||||
|
||||
@ -993,7 +993,7 @@ class FormMail extends Form
|
||||
$sql = "SELECT label, topic, joinfiles, content, content_lines, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
|
||||
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
|
||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
@ -1065,7 +1065,7 @@ class FormMail extends Form
|
||||
$sql = "SELECT label, topic, content, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
$sql.= $this->db->order("lang,label","ASC");
|
||||
@ -1102,7 +1102,7 @@ class FormMail extends Form
|
||||
$sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 1).")";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
|
||||
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own.
|
||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||
//if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; // Return all languages
|
||||
|
||||
@ -61,13 +61,15 @@ class FormOther
|
||||
* @param string $htmlname Nom de la zone select
|
||||
* @param string $type Type des modeles recherches
|
||||
* @param int $useempty Affiche valeur vide dans liste
|
||||
* @param int $fk_user Utilisateur créant le modèle
|
||||
* @return void
|
||||
*/
|
||||
function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0)
|
||||
function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0, $fk_user=null)
|
||||
{
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
if(!empty($fk_user))$sql.=" AND fk_user=".$fk_user;
|
||||
$sql.= " ORDER BY rowid";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -47,7 +47,7 @@ class FormProjets
|
||||
* Output a combo list with projects qualified for a third party / user
|
||||
*
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id project preselected
|
||||
* @param string $selected Id project preselected ('' or id of project)
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
|
||||
@ -404,13 +404,13 @@ class Notify
|
||||
break;
|
||||
case 'FICHINTER_ADD_CONTACT':
|
||||
$link='/fichinter/card.php?id='.$object->id;
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref);
|
||||
break;
|
||||
case 'FICHINTER_VALIDATE':
|
||||
$link='/fichinter/card.php?id='.$object->id;
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
|
||||
break;
|
||||
@ -664,8 +664,9 @@ class Notify
|
||||
}
|
||||
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
|
||||
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
|
||||
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
|
||||
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
|
||||
$sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
|
||||
$sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
|
||||
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
|
||||
}
|
||||
|
||||
if ($sendto)
|
||||
|
||||
@ -580,7 +580,7 @@ function modules_prepare_head()
|
||||
*/
|
||||
function security_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -616,8 +616,26 @@ function security_prepare_head()
|
||||
$head[$h][2] = 'audit';
|
||||
$h++;
|
||||
|
||||
|
||||
// Show permissions lines
|
||||
$nbPerms=0;
|
||||
$sql = "SELECT COUNT(r.id) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND bydefault = 1";
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $nbPerms = $obj->nb;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/perms.php";
|
||||
$head[$h][1] = $langs->trans("DefaultRights");
|
||||
if ($nbPerms > 0) $head[$h][1].= ' <span class="badge">'.$nbPerms.'</span>';
|
||||
$head[$h][2] = 'default';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -640,7 +640,6 @@ function isInEEC($object)
|
||||
function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='')
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
|
||||
$i = -1 ;
|
||||
|
||||
@ -768,10 +767,10 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
*/
|
||||
function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
global $user,$conf;
|
||||
global $bc;
|
||||
global $user,$conf,$extrafields,$hookmanager;
|
||||
global $contextpage;
|
||||
|
||||
$form= new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -782,24 +781,67 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
$search_addressphone = GETPOST("search_addressphone",'alpha');
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.lastname";
|
||||
if (! $sortfield) $sortfield="t.lastname";
|
||||
|
||||
if (! empty($conf->clicktodial->enabled))
|
||||
{
|
||||
$user->fetch_clicktodial(); // lecture des infos de clicktodial du user
|
||||
}
|
||||
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($contactstatic->table_element);
|
||||
|
||||
$contactstatic->fields=array(
|
||||
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOfFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20),
|
||||
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30),
|
||||
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>40, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0,1), 1=>$contactstatic->LibStatut(1,1))),
|
||||
);
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields=array(
|
||||
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'position'=>1),
|
||||
't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10),
|
||||
't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20),
|
||||
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
|
||||
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>40, 'align'=>'center'),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label']))
|
||||
{
|
||||
foreach($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$contactstatic->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$contactstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$contactstatic->table_element]['list'][$key])!=3 && $extrafields->attributes[$contactstatic->table_element]['perms'][$key]));
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search=array();
|
||||
foreach($contactstatic->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
|
||||
}
|
||||
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_status = '';
|
||||
$search_name = '';
|
||||
$search_addressphone = '';
|
||||
$search_array_options=array();
|
||||
|
||||
foreach($contactstatic->fields as $key => $val)
|
||||
{
|
||||
$search[$key]='';
|
||||
}
|
||||
$toselect='';
|
||||
}
|
||||
|
||||
$i=-1;
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
if (! empty($conf->clicktodial->enabled))
|
||||
{
|
||||
$user->fetch_clicktodial(); // lecture des infos de clicktodial
|
||||
}
|
||||
$contactstatic->fields = dol_sort_array($contactstatic->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$buttoncreate='';
|
||||
if ($user->rights->societe->contact->creer)
|
||||
@ -815,26 +857,32 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print load_fiche_titre($title, $buttoncreate,'');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
//if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print "\n".'<table class="tagtable liste">'."\n";
|
||||
|
||||
$param="socid=".$object->id;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
|
||||
|
||||
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,";
|
||||
$sql .= " p.civility as civility_id, p.address, p.zip, p.town";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')";
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
|
||||
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
$sql .= " WHERE t.fk_soc = ".$object->id;
|
||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
|
||||
if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')";
|
||||
if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder";
|
||||
else $sql.= " ORDER BY $sortfield $sortorder";
|
||||
|
||||
dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -842,59 +890,63 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$colspan=9;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
// Photo - Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat minwidth75" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
|
||||
// Position
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
// Address - Phone - Email
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
|
||||
print '</td>';
|
||||
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$colspan++;
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
|
||||
// Action
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$titlefieldaddress=$langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email");
|
||||
if (! empty($conf->dol_optimize_smallscreen)) $titlefieldaddress=$langs->trans("Address");
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($titlefieldaddress,$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre('');
|
||||
// Edit
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
foreach($contactstatic->fields as $key => $val)
|
||||
{
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($key, array('lastname','name'))) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
elseif (in_array($key, array('statut'))) print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($contactstatic->fields as $key => $val)
|
||||
{
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i = -1;
|
||||
|
||||
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
|
||||
{
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -923,46 +975,81 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
$contactstatic->country_code = $country_code;
|
||||
|
||||
$contactstatic->setGenderFromCivility();
|
||||
$contactstatic->fetch_optionals();
|
||||
|
||||
if (is_array($contactstatic->array_options))
|
||||
{
|
||||
foreach($contactstatic->array_options as $key => $val)
|
||||
{
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// ID
|
||||
if (! empty($arrayfields['t.rowid']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $contactstatic->id;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Photo - Name
|
||||
print '<td>';
|
||||
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1);
|
||||
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
|
||||
print '</td>';
|
||||
if (! empty($arrayfields['t.name']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1);
|
||||
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Job position
|
||||
print '<td>';
|
||||
if ($obj->poste) print $obj->poste;
|
||||
print '</td>';
|
||||
if (! empty($arrayfields['t.poste']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->poste) print $obj->poste;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Address - Phone - Email
|
||||
print '<td>';
|
||||
print $contactstatic->getBannerAddress('contact', $object);
|
||||
print '</td>';
|
||||
if (! empty($arrayfields['t.address']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $contactstatic->getBannerAddress('contact', $object);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<td align="center">'.$contactstatic->getLibStatut(5).'</td>';
|
||||
if (! empty($arrayfields['t.statut']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$contactstatic->getLibStatut(5).'</td>';
|
||||
}
|
||||
|
||||
// Add to agenda
|
||||
// Extra fields
|
||||
$extrafieldsobjectkey='socpeople';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
|
||||
// Actions
|
||||
print '<td align="right">';
|
||||
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_object($langs->trans("Event"),"action");
|
||||
print '</a></td>';
|
||||
print '</a> ';
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
print '</a>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -970,9 +1057,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print "</tr>\n";
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "\n</table>\n";
|
||||
print '</div>';
|
||||
@ -995,7 +1082,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php';
|
||||
|
||||
@ -1087,7 +1173,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
*/
|
||||
function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$actioncode='')
|
||||
{
|
||||
global $bc,$user,$conf;
|
||||
global $user,$conf;
|
||||
|
||||
$out = show_actions_done($conf,$langs,$db,$filterobj,$objcon,1,$actioncode, 'todo');
|
||||
|
||||
@ -1114,7 +1200,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
|
||||
*/
|
||||
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC')
|
||||
{
|
||||
global $bc,$user,$conf;
|
||||
global $user,$conf;
|
||||
global $form;
|
||||
|
||||
global $param;
|
||||
@ -1142,14 +1228,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
|
||||
$sql.= " WHERE u.rowid = a.fk_user_action";
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Adherent')
|
||||
@ -1192,7 +1278,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
|
||||
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -1298,7 +1383,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email)))
|
||||
{
|
||||
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||
@ -1385,7 +1469,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
|
||||
foreach ($histo as $key=>$value)
|
||||
{
|
||||
|
||||
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
|
||||
|
||||
$out.='<tr class="oddeven">';
|
||||
@ -1407,8 +1490,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
//$userstatic->id=$histo[$key]['userid'];
|
||||
//$userstatic->login=$histo[$key]['login'];
|
||||
//$out.=$userstatic->getLoginUrl(1);
|
||||
$userstatic->fetch($histo[$key]['userid']);
|
||||
$out.=$userstatic->getNomUrl(-1);
|
||||
if ($histo[$key]['userid'] > 0)
|
||||
{
|
||||
$userstatic->fetch($histo[$key]['userid']);
|
||||
$out.=$userstatic->getNomUrl(-1);
|
||||
}
|
||||
$out.='</td>';
|
||||
|
||||
// Type
|
||||
@ -1560,7 +1646,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
function show_subsidiaries($conf,$langs,$db,$object)
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
|
||||
$i=-1;
|
||||
|
||||
|
||||
@ -1706,7 +1706,15 @@ function dol_convert_file($fileinput, $ext='png', $fileoutput='')
|
||||
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
|
||||
|
||||
$count = $image->getNumberImages();
|
||||
$ret = $image->writeImages($fileoutput, true);
|
||||
|
||||
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
|
||||
{
|
||||
$ret = $image->writeImages($fileoutput, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Warning: Failed to write cache preview file '.$fileoutput.'. Check permission on file/dir", LOG_ERR);
|
||||
}
|
||||
if ($ret) return $count;
|
||||
else return -3;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
|
||||
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
|
||||
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
|
||||
* 'email_template', 'event', 'donation'
|
||||
* 'c_paiement', ...
|
||||
* 'c_paiement', 'c_payment_term', ...
|
||||
* @param int $shared 0=Return id of current entity only,
|
||||
* 1=Return id of current entity + shared entities (default)
|
||||
* @param int $forceentity Entity id
|
||||
@ -550,7 +550,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
|
||||
if (! is_array($out) || empty($out)) $out=array();
|
||||
break;
|
||||
case 'nohtml':
|
||||
$out=dol_string_nohtmltag($out);
|
||||
$out=dol_string_nohtmltag($out, 0);
|
||||
break;
|
||||
case 'alphanohtml': // Recommended for search params
|
||||
if (! is_array($out))
|
||||
@ -1494,7 +1494,20 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
|
||||
$morehtmlstatus.=$tmptxt;
|
||||
}
|
||||
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
|
||||
|
||||
// Add if object was dispatched "into accountancy"
|
||||
if (! empty($conf->accounting->enabled) && in_array($object->element, array('bank', 'facture', 'invoice', 'invoice_supplier', 'expensereport')))
|
||||
{
|
||||
if (method_exists($object, 'getVentilExportCompta'))
|
||||
{
|
||||
$accounted = $object->getVentilExportCompta();
|
||||
$langs->load("accountancy");
|
||||
$morehtmlstatus.='</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
|
||||
}
|
||||
}
|
||||
|
||||
// Add alias for thirdparty
|
||||
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';
|
||||
|
||||
// Add label
|
||||
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
|
||||
@ -2175,7 +2188,7 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
|
||||
*/
|
||||
function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='',$titlealt='',$adddivfloat=0)
|
||||
{
|
||||
global $conf,$user,$langs,$mysoc;
|
||||
global $conf, $user, $langs, $mysoc, $hookmanager;
|
||||
|
||||
// Clean phone parameter
|
||||
$phone = preg_replace("/[\s.-]/","",trim($phone));
|
||||
@ -2265,23 +2278,33 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
|
||||
$titlealt=($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone"));
|
||||
}
|
||||
$rep='';
|
||||
$picto = '';
|
||||
if($withpicto){
|
||||
if($withpicto=='fax'){
|
||||
$picto = 'phoning_fax';
|
||||
}elseif($withpicto=='phone'){
|
||||
$picto = 'phoning';
|
||||
}elseif($withpicto=='mobile'){
|
||||
$picto = 'phoning_mobile';
|
||||
}else{
|
||||
$picto = '';
|
||||
|
||||
if ($hookmanager) {
|
||||
$parameters = array('countrycode' => $countrycode, 'cid' => $cid, 'socid' => $socid,'titlealt' => $titlealt, 'picto' => $withpicto);
|
||||
$reshook = $hookmanager->executeHooks('printPhone', $parameters, $phone);
|
||||
$rep.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
$picto = '';
|
||||
if($withpicto){
|
||||
if($withpicto=='fax'){
|
||||
$picto = 'phoning_fax';
|
||||
}elseif($withpicto=='phone'){
|
||||
$picto = 'phoning';
|
||||
}elseif($withpicto=='mobile'){
|
||||
$picto = 'phoning_mobile';
|
||||
}else{
|
||||
$picto = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($adddivfloat) $rep.='<div class="nospan float" style="margin-right: 10px">';
|
||||
else $rep.='<span style="margin-right: 10px;">';
|
||||
$rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone;
|
||||
if ($adddivfloat) $rep.='</div>';
|
||||
else $rep.='</span>';
|
||||
if ($adddivfloat) $rep.='<div class="nospan float" style="margin-right: 10px">';
|
||||
else $rep.='<span style="margin-right: 10px;">';
|
||||
$rep.=($withpicto?img_picto($titlealt, 'object_'.$picto.'.png').' ':'').$newphone;
|
||||
if ($adddivfloat) $rep.='</div>';
|
||||
else $rep.='</span>';
|
||||
}
|
||||
|
||||
return $rep;
|
||||
}
|
||||
|
||||
@ -3344,18 +3367,19 @@ function img_searchclear($titlealt = 'default', $other = '')
|
||||
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
|
||||
* @param int $nodiv No div
|
||||
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'xxx'=Other
|
||||
* @param string $morecss More CSS
|
||||
* @return string String with info text
|
||||
*/
|
||||
function info_admin($text, $infoonimgalt = 0, $nodiv=0, $admin='1')
|
||||
function info_admin($text, $infoonimgalt = 0, $nodiv=0, $admin='1', $morecss='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($infoonimgalt)
|
||||
{
|
||||
return img_picto($text, 'info', 'class="hideonsmartphone"');
|
||||
return img_picto($text, 'info', 'class="hideonsmartphone'.($morecss?' '.$morecss:'').'"');
|
||||
}
|
||||
|
||||
return ($nodiv?'':'<div class="'.(empty($admin)?'':($admin=='1'?'info':$admin)).' hideonsmartphone">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin?$langs->trans('InfoAdmin'):$langs->trans('Note')).'"></span> '.$text.($nodiv?'':'</div>');
|
||||
return ($nodiv?'':'<div class="'.(empty($admin)?'':($admin=='1'?'info':$admin)).' hideonsmartphone'.($morecss?' '.$morecss:'').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin?$langs->trans('InfoAdmin'):$langs->trans('Note')).'"></span> '.$text.($nodiv?'':'</div>');
|
||||
}
|
||||
|
||||
|
||||
@ -3496,15 +3520,16 @@ function dol_print_error($db='',$error='',$errors=null)
|
||||
* @param string $prefixcode Prefix of public error code
|
||||
* @param string $errormessage Complete error message
|
||||
* @param array $errormessages Array of error messages
|
||||
* @param string $morecss More css
|
||||
* @return void
|
||||
*/
|
||||
function dol_print_error_email($prefixcode, $errormessage='', $errormessages=array())
|
||||
function dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$langs->load("errors");
|
||||
$now=dol_now();
|
||||
print '<br><div class="center login_main_message"><div class="error">';
|
||||
print '<br><div class="center login_main_message"><div class="'.$morecss.'">';
|
||||
print $langs->trans("ErrorContactEMail", $conf->global->MAIN_INFO_SOCIETE_MAIL, $prefixcode.dol_print_date($now,'%Y%m%d'));
|
||||
if ($errormessage) print '<br><br>'.$errormessage;
|
||||
if (is_array($errormessages) && count($errormessages))
|
||||
@ -5607,7 +5632,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
'__USER_LASTNAME__' => (string) $user->lastname,
|
||||
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
||||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) $user->fk_user
|
||||
'__USER_SUPERVISOR_ID__' => (string) $user->fk_user,
|
||||
'__USER_REMOTE_IP__' => (string) $_SERVER['REMOTE_ADDR']
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -5620,10 +5646,15 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
}
|
||||
|
||||
/**
|
||||
* Make substition into a text string, replacing keys with vals from $substitutionarray (oldval=>newval).
|
||||
* Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newval).
|
||||
* Texts like __(TranslationKey|langfile)__ and __[ConstantKey]__ are also replaced.
|
||||
* Example of usage:
|
||||
* $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $thirdparty);
|
||||
* complete_substitutions_array($substitutionarray, $langs, $thirdparty);
|
||||
* $mesg = make_substitutions($mesg, $substitutionarray, $langs);
|
||||
*
|
||||
* @param string $text Source string in which we must do substitution
|
||||
* @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal')
|
||||
* @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...)
|
||||
* @param Translate $outputlangs Output language
|
||||
* @return string Output string after substitutions
|
||||
* @see complete_substitutions_array
|
||||
@ -6279,7 +6310,7 @@ function dol_validElement($element)
|
||||
* Return img flag of country for a language code or country code
|
||||
*
|
||||
* @param string $codelang Language code (en_IN, fr_CA...) or Country code (IN, FR)
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @return string HTML img string with flag.
|
||||
*/
|
||||
function picto_from_langcode($codelang, $moreatt = '')
|
||||
@ -6292,7 +6323,7 @@ function picto_from_langcode($codelang, $moreatt = '')
|
||||
|
||||
if ($codelang == 'auto')
|
||||
{
|
||||
return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png', $moreatt);
|
||||
return '<span class="fa fa-globe"></span>';
|
||||
}
|
||||
|
||||
$langtocountryflag = array(
|
||||
|
||||
@ -995,7 +995,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
else dol_print_error($db);
|
||||
|
||||
// Check if we must force counter to maskoffset
|
||||
if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset;
|
||||
if (empty($counter)) $counter=$maskoffset;
|
||||
else if (preg_match('/[^0-9]/i',$counter))
|
||||
{
|
||||
$counter=0;
|
||||
dol_syslog("Error, the last counter found is '".$counter."' so is not a numeric value. We will restart to 1.", LOG_ERR);
|
||||
}
|
||||
else if ($counter < $maskoffset && empty($conf->global->MAIN_NUMBERING_OFFSET_ONLY_FOR_FIRST)) $counter=$maskoffset;
|
||||
|
||||
if ($mode == 'last') // We found value for counter = last counter value. Now need to get corresponding ref of invoice.
|
||||
@ -1503,7 +1508,7 @@ function dol_print_reduction($reduction,$langs)
|
||||
}
|
||||
else
|
||||
{
|
||||
$string = price($reduction).'%';
|
||||
$string = vatrate($reduction,true);
|
||||
}
|
||||
|
||||
return $string;
|
||||
@ -2253,6 +2258,9 @@ function getModuleDirForApiClass($module)
|
||||
elseif ($module == 'users') {
|
||||
$moduledirforclass = 'user';
|
||||
}
|
||||
elseif ($module == 'ficheinter' || $module == 'interventions') {
|
||||
$moduledirforclass = 'fichinter';
|
||||
}
|
||||
|
||||
return $moduledirforclass;
|
||||
}
|
||||
|
||||
@ -38,7 +38,8 @@ if (! function_exists('json_encode'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement json_encode for PHP that does not support it
|
||||
* Implement json_encode for PHP that does not support it.
|
||||
* Use json_encode and json_decode in your code !
|
||||
*
|
||||
* @param mixed $elements PHP Object to json encode
|
||||
* @return string Json encoded string
|
||||
@ -221,6 +222,7 @@ if (! function_exists('json_decode'))
|
||||
|
||||
/**
|
||||
* Implement json_decode for PHP that does not support it
|
||||
* Use json_encode and json_decode in your code !
|
||||
*
|
||||
* @param string $json Json encoded to PHP Object or Array
|
||||
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
|
||||
|
||||
@ -76,11 +76,16 @@ function dol_decode($chain)
|
||||
* @param string $chain String to hash
|
||||
* @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
|
||||
* @return string Hash of string
|
||||
* @getRandomPassword
|
||||
*/
|
||||
function dol_hash($chain, $type='0')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// No need to add salt for password_hash
|
||||
if ($type == '0' && ! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'password_hash' && function_exists('password_hash'))
|
||||
return password_hash($chain, PASSWORD_DEFAULT);
|
||||
|
||||
// Salt value
|
||||
if (! empty($conf->global->MAIN_SECURITY_SALT)) $chain=$conf->global->MAIN_SECURITY_SALT.$chain;
|
||||
|
||||
@ -96,6 +101,32 @@ function dol_hash($chain, $type='0')
|
||||
return md5($chain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute a hash and compare it to the given one
|
||||
* For backward compatibility reasons, if the hash is not in the password_hash format, we will try to match against md5 and sha1md5
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function.
|
||||
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
|
||||
*
|
||||
* @param string $chain String to hash
|
||||
* @param string $hash hash to compare
|
||||
* @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
|
||||
* @return bool True if the computed hash is the same as the given one
|
||||
*/
|
||||
function dol_verifyHash($chain, $hash, $type='0')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($type == '0' && ! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'password_hash' && function_exists('password_verify')) {
|
||||
if ($hash[0] == '$') return password_verify($chain, $hash);
|
||||
else if(strlen($hash) == 32) return dol_verifyHash($chain, $hash, '3'); // md5
|
||||
else if(strlen($hash) == 40) return dol_verifyHash($chain, $hash, '2'); // sha1md5
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return dol_hash($chain, $type) == $hash;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check permissions of a user to show a page and an object. Check read permission.
|
||||
@ -606,4 +637,3 @@ function accessforbidden($message='',$printheader=1,$printfooter=1,$showonlymess
|
||||
if ($printfooter && function_exists("llxFooter")) llxFooter();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@ -445,6 +445,7 @@ function encodedecode_dbpassconf($level=0)
|
||||
*
|
||||
* @param boolean $generic true=Create generic password (32 chars/numbers), false=Use the configured password generation module
|
||||
* @return string New value for password
|
||||
* @see dol_hash
|
||||
*/
|
||||
function getRandomPassword($generic=false)
|
||||
{
|
||||
|
||||
@ -79,6 +79,17 @@ function shipping_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note_private)) $nbNote++;
|
||||
if (!empty($object->note_public)) $nbNote++;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 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
|
||||
@ -45,6 +46,17 @@ function vat_prepare_head($object)
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Info");
|
||||
|
||||
@ -84,7 +84,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
|
||||
// Check crypted password according to crypt algorithm
|
||||
if ($cryptType == 'md5')
|
||||
{
|
||||
if (dol_hash($passtyped) == $passcrypted)
|
||||
if (dol_verifyHash($passtyped, $passcrypted))
|
||||
{
|
||||
$passok=true;
|
||||
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - ".$cryptType." of pass is ok");
|
||||
@ -152,5 +152,3 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
|
||||
|
||||
return $login;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 54, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
|
||||
@ -168,23 +168,25 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'billing', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'List', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', '', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', 'suppliers_bills_payment', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills_payment', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', 'suppliers_bills_reports', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills_reports', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
|
||||
-- Billing - Customer invoice
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
||||
-- Billing - Orders to bill
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
||||
-- Donations
|
||||
|
||||
@ -169,7 +169,8 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode)
|
||||
if ($showmode)
|
||||
{
|
||||
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
|
||||
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
|
||||
//print '<div class="tmenuleft tmenusep"></div>';
|
||||
print '<div class="tmenucenter">';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -164,28 +164,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
$menu->add('/compta/index.php?mainmenu=billing&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "billing", '', 50, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Accounting
|
||||
$menuqualified=0;
|
||||
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
|
||||
if (! empty($conf->accounting->enabled)) $menuqualified++;
|
||||
$tmpentry=array(
|
||||
'enabled'=>$menuqualified,
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire)),
|
||||
'module'=>'comptabilite|accounting');
|
||||
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
$langs->load("compta");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='accountancy';
|
||||
|
||||
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuAccountancy"), 0, $showmode, $atarget, "accountancy", '', 52, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
|
||||
// Bank
|
||||
$tmpentry=array('enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
|
||||
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
|
||||
@ -201,7 +179,28 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='bank';
|
||||
|
||||
$menu->add('/compta/bank/list.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
|
||||
$menu->add('/compta/bank/list.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 52, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Accounting
|
||||
$menuqualified=0;
|
||||
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
|
||||
if (! empty($conf->accounting->enabled)) $menuqualified++;
|
||||
$tmpentry=array(
|
||||
'enabled'=>$menuqualified,
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire)),
|
||||
'module'=>'comptabilite|accounting');
|
||||
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
$langs->load("compta");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='accountancy';
|
||||
|
||||
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuAccountancy"), 0, $showmode, $atarget, "accountancy", '', 54, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Projects
|
||||
@ -362,7 +361,8 @@ function print_start_menu_entry($idsel,$classname,$showmode)
|
||||
if ($showmode)
|
||||
{
|
||||
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
|
||||
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
|
||||
//print '<div class="tmenuleft tmenusep"></div>';
|
||||
print '<div class="tmenucenter">';
|
||||
}
|
||||
}
|
||||
|
||||
@ -803,24 +803,24 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/compta/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->facture->creer);
|
||||
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("List"),1,$user->rights->facture->lire, '', $mainmenu, 'customers_bills_list');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu))
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|draft|notpaid|paid|canceled)$/', $leftmenu))
|
||||
{
|
||||
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0",$langs->trans("BillShortStatusDraft"),2,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1",$langs->trans("BillShortStatusNotPaid"),2,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2",$langs->trans("BillShortStatusPaid"),2,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3",$langs->trans("BillShortStatusCanceled"),2,$user->rights->facture->lire);
|
||||
}
|
||||
$newmenu->add("/compta/facture/invoicetemplate_list.php",$langs->trans("ListOfTemplates"),1,$user->rights->facture->creer); // No need to see recurring invoices, if user has no permission to create invoice.
|
||||
$newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates",$langs->trans("ListOfTemplates"),1,$user->rights->facture->creer,'',$mainmenu,'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice.
|
||||
|
||||
$newmenu->add("/compta/paiement/list.php",$langs->trans("Payments"),1,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment",$langs->trans("Payments"),1,$user->rights->facture->lire,'',$mainmenu,'customers_bills_payment');
|
||||
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
{
|
||||
$newmenu->add("/compta/paiement/avalider.php",$langs->trans("MenuToValid"),2,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/paiement/avalider.php?leftmenu=customers_bills_tovalid",$langs->trans("MenuToValid"),2,$user->rights->facture->lire,'',$mainmenu,'customer_bills_tovalid');
|
||||
}
|
||||
$newmenu->add("/compta/paiement/rapport.php",$langs->trans("Reportings"),2,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_reports",$langs->trans("Reportings"),2,$user->rights->facture->lire,'',$mainmenu,'customers_bills_reports');
|
||||
|
||||
$newmenu->add("/compta/facture/stats/index.php", $langs->trans("Statistics"),1,$user->rights->facture->lire);
|
||||
$newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"),1,$user->rights->facture->lire,'',$mainmenu,'customers_bills_stats');
|
||||
}
|
||||
|
||||
// Suppliers invoices
|
||||
@ -828,7 +828,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$langs->load("bills");
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
$newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
|
||||
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {
|
||||
@ -837,11 +837,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid');
|
||||
}
|
||||
|
||||
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
|
||||
$newmenu->add("/fourn/facture/paiement.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment');
|
||||
|
||||
$newmenu->add("/fourn/facture/rapport.php",$langs->trans("Reportings"),2,$user->rights->fournisseur->facture->lire);
|
||||
$newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_report",$langs->trans("Reportings"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_report');
|
||||
|
||||
$newmenu->add("/compta/facture/stats/index.php?mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
|
||||
$newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats');
|
||||
}
|
||||
|
||||
// Orders
|
||||
|
||||
@ -536,7 +536,8 @@ function print_start_menu_entry_empty($idsel,$classname,$showmode)
|
||||
if ($showmode)
|
||||
{
|
||||
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
|
||||
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
|
||||
//print '<div class="tmenuleft tmenusep"></div>';
|
||||
print '<div class="tmenucenter">';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -139,10 +139,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$this->posxtva=99;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=130;
|
||||
$this->posxunit=147;
|
||||
$this->posxtva=101;
|
||||
$this->posxup=118;
|
||||
$this->posxqty=135;
|
||||
$this->posxunit=151;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -348,6 +348,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
if ($notetoshow)
|
||||
{
|
||||
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
|
||||
|
||||
$tab_top = 88 + $height_incoterms;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
@ -419,9 +423,11 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription=$pdf->GetY();
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
@ -610,13 +616,13 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||
$this->error=$langs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -516,6 +517,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
{
|
||||
@ -532,6 +534,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->AddPage();
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -262,10 +262,14 @@ class pdf_standard extends ModeleExpenseReport
|
||||
}
|
||||
if ($notetoshow)
|
||||
{
|
||||
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
|
||||
|
||||
$tab_top = 95;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxpiece-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxpiece-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
|
||||
@ -299,7 +303,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$curY = $nexY;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
|
||||
|
||||
// Accountancy piece
|
||||
$pdf->SetXY($this->posxpiece, $curY);
|
||||
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
|
||||
@ -327,7 +331,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C');
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxprojet, $curY);
|
||||
@ -429,7 +433,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
}
|
||||
|
||||
$pdf->SetFont('','', 10);
|
||||
|
||||
|
||||
// Show total area box
|
||||
$posy=$bottomlasttab+5;
|
||||
$pdf->SetXY(100, $posy);
|
||||
@ -475,7 +479,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
@ -585,7 +589,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->SetFont('','B', $default_font_size + 2);
|
||||
$pdf->SetTextColor(111,81,124);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
|
||||
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
@ -731,7 +735,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
// Force to disable hidetop and hidebottom
|
||||
$hidebottom=0;
|
||||
if ($hidetop) $hidetop=-1;
|
||||
@ -789,7 +793,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
|
||||
}
|
||||
|
||||
if (!empty($conf->projet->enabled))
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
// Project
|
||||
$pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user