Merge branch 'develop' into dev_19763
This commit is contained in:
commit
b43159db6d
@ -18,9 +18,10 @@ filter:
|
||||
- dev/*
|
||||
- doc/*
|
||||
- documents/*
|
||||
- htdocs/includes/*
|
||||
- node_modules/*
|
||||
- test/*
|
||||
dependency_paths:
|
||||
- htdocs/includes/*
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
|
||||
@ -24,7 +24,6 @@ Component Version License GPL Compatible
|
||||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
@ -50,6 +49,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes
|
||||
JS libraries:
|
||||
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
jQuery 3.6.0 MIT License Yes JS library
|
||||
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
|
||||
275
ChangeLog
275
ChangeLog
@ -9,21 +9,177 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW: PHP 8.0 compatibility
|
||||
|
||||
|
||||
NEW: PHP 8.1 compatibility
|
||||
NEW: Support for recurring purchase invoices.
|
||||
NEW: #20292 Include German public holidays
|
||||
NEW: #17123 added ExtraFields for Stock Mouvement
|
||||
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
|
||||
NEW: #20653 edit discount pourcentage for all lines in one shot
|
||||
NEW: Accept 'auto' for ref of object on import of purchase order/proposal
|
||||
NEW: Accountancy - Add more filters and info on page to bind accounting accounts
|
||||
NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice
|
||||
NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list)
|
||||
NEW: ACE Editor is restored at same cursor position after a save.
|
||||
NEW: Add "addMoreActionsButtons" hook to subscription form
|
||||
NEW: Add an option in GUI to show a Quick add button into top menu bar
|
||||
NEW: Module Recruitment - Add a public page with all list of open job positions.
|
||||
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
|
||||
NEW: Add a workflow to auto link contract on a ticket
|
||||
NEW: Add column date of Signature on proposal list
|
||||
NEW: Add column template invoice in invoice list
|
||||
NEW: Add column "Total HT" to products array on document creation card
|
||||
NEW: ADD configuration for text color of button action
|
||||
NEW: Add constant to hide categories in TakePos
|
||||
NEW: Add constant to show category description in TakePos
|
||||
NEW: Add constant to show only the products in stock in TakePos
|
||||
NEW: Add entity filter in exports
|
||||
NEW: Show the event block on recurring invoices #20870
|
||||
NEW: Add filter "opportunity status" on statistics of projects.
|
||||
NEW: Add firstname, lastname and max number of attendees for module "Event Organization"
|
||||
NEW: add margin info in proposal and order list
|
||||
NEW: Add massaction "Edit Extrafield" for Product
|
||||
NEW: Add more fields to detect duplicate during import of thirdparties
|
||||
NEW: Add option to foce delivery on email for purchase order receipt to yes
|
||||
NEW: Add param boder table for md theme
|
||||
NEW: Add param color button action
|
||||
NEW: Add possibility to create contract from invoice
|
||||
NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name
|
||||
NEW: Add private and public notes on tax files.
|
||||
NEW: Add status "Obsolete" to KM articles
|
||||
NEW: Add substitutions "user numbers"
|
||||
NEW: Add the possibility to add sub-BOMs to BOM
|
||||
NEW: allow a ticket to be automatically marked as read when created from backend.
|
||||
NEW: allow cut&paste as real numeric value to excel
|
||||
NEW: A public form to send a message and create a lead is available
|
||||
NEW: automatically set totally received status in reception
|
||||
NEW: Auto set invoice paid when adding credit not and remain to pay is 0
|
||||
NEW: Availibility dictionnary has a new column unit and number
|
||||
NEW: barcode rule to insert product in takepos
|
||||
NEW: Can change value of AWP during the inventory
|
||||
NEW: Can enter price with tax for predefined products on purchase objects
|
||||
NEW: Can filter on a thirdparty on product statistics
|
||||
NEW: Can removed doc templates from setup page of thirdparty
|
||||
NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
|
||||
NEW: Can use ! to make a search that exclude a string
|
||||
NEW: Change in theme colors does not need to use the refresh button
|
||||
NEW: clean values and amount in FEC import
|
||||
NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action
|
||||
NEW: Contact filter project list
|
||||
NEW: Create contract from invoice
|
||||
NEW: create third-party with contact if not found on public ticket
|
||||
NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
|
||||
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
|
||||
NEW: Dictionaries - add possibility to manage countries in EEC
|
||||
NEW: display errors in a message box after generating documents
|
||||
NEW: Display physical and virtual stock of the products when creating OF from a BOM
|
||||
NEW: Display product ref in "Object link" product tab for BOM
|
||||
NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
|
||||
NEW: Events on Proposal to Return to Draft
|
||||
NEW: Page to list expense report payments
|
||||
NEW: JS inventory autocalc input
|
||||
NEW: language support for more emailing target selectors
|
||||
NEW: leave requests: add field into type dictionary to block request if balance is negative
|
||||
NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
|
||||
NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
|
||||
NEW: Mass action "Close shipments"
|
||||
NEW: Module website now supports the multicompany module
|
||||
NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
|
||||
NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens)
|
||||
NEW: Add tabs for nets Bom
|
||||
NEW: on redirect of page in website module, GET parameters are kept.
|
||||
NEW: optional display warning icons on ticket list
|
||||
NEW: option to default check "notify tier at creation" in ticket module
|
||||
NEW: option update prices on proposal cloning
|
||||
NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439)
|
||||
NEW: possibility to consume multiple batch
|
||||
NEW: Reverse movement product consumption
|
||||
NEW: Send email to the supplier order contact
|
||||
NEW: New permission to report time on timesheet.
|
||||
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
|
||||
NEW: Show number of votes into the label of tab "Results" of a survey
|
||||
NEW: Show product reference in Takepos
|
||||
NEW: Some core tables are created only at module activation
|
||||
NEW: split consumption line on MO
|
||||
NEW: stock filter in reassort lists
|
||||
NEW: stock limit in stock export CSV
|
||||
NEW: Sub-bom are availables
|
||||
NEW: Supplier order - Show ref supplier of reception in linked object block
|
||||
NEW: support user_modif in order
|
||||
NEW: TakePos - pagination on search results
|
||||
NEW: The backup tools has an "lowmemory" option for mysqldump on large database
|
||||
NEW: The 'reposition' class works on ajax constantonoff that make redirects
|
||||
NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
|
||||
NEW: thumbnail field in product list
|
||||
NEW: total mark rate in list
|
||||
NEW: uncheck "send message" by default on a ticket when private messages has been checked
|
||||
NEW: VAT Report by month - Show detail by rate and also by code
|
||||
NEW: Ticket triggers: allow to automatically send messages on new tickets
|
||||
NEW: Accountancy - Add hidden feature for accounting reconciliation
|
||||
NEW: Can store the session into database (instead of beeing managed by PHP)
|
||||
|
||||
Modules
|
||||
NEW: Module Partnership Management
|
||||
NEW: Experimental module Event Organization Management
|
||||
NEW: Experimental module Workstations Management
|
||||
NEW: Experimental module Partnership Management
|
||||
|
||||
|
||||
For developers:
|
||||
---------------
|
||||
|
||||
NEW: A lot of addition of hooks.
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
|
||||
NEW: Implement a generic method for Kaban views
|
||||
NEW: Upgrade chartjs library to 3.7.1
|
||||
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
|
||||
NEW: stripe element with more gateways
|
||||
NEW: solde() function evolution to be able to get solde until a chosen date
|
||||
NEW: Suggest a way to run upgrade per entities.
|
||||
NEW: Support html content for multiselect component.
|
||||
NEW: ModuleBuilder - Add tabs view in module builder
|
||||
NEW: ModuleBuilder - More feature that can be modifed after module generation
|
||||
NEW: Hook getNomUrl available everywhere in tooltip of ref links
|
||||
NEW: Identification of tr is possible with by attribute data-id on some pages
|
||||
NEW: Import with select boxes V2
|
||||
NEW: Can update rank of invoice, proposal and order lines with API update
|
||||
NEW: Can use current entity filter on 'chkbxlst'
|
||||
NEW: Creation of the function select_bom() used to display bom select list
|
||||
NEW: add printFieldListWhere hook in product reassort card
|
||||
NEW: Add trigger and event on completely received status change
|
||||
NEW: Add utility function send backup by mail
|
||||
NEW: add WordPress OAuth to save a token (not SSO)
|
||||
NEW: A module can embed a sql script run at each Dolibarr upgrade
|
||||
NEW: API Proposals - Add POST lines
|
||||
NEW: API REST filter states by country
|
||||
NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
|
||||
NEW: Add option MAIN_API_DEBUG to save API logs into a file
|
||||
NEW: Add param to keep the robot=index meta tag on public pages
|
||||
NEW: Add method hintindex() in database handlers.
|
||||
NEW: add modifications for new function "$db->prefix()"
|
||||
NEW: addMoreActionsButtonsList hook for button in list
|
||||
NEW: Add API to get a template invoice
|
||||
NEW: Standardize a lot of code.
|
||||
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
|
||||
NEW: #19294 implement detailed timespent in task of project API
|
||||
NEW: Add a protection into PHPunit to avoid to forget a var_dump
|
||||
NEW: Add datem and type parameters to API to create movements
|
||||
NEW: Add hidden option on contract PDF line to hide qty and price
|
||||
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
|
||||
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
|
||||
NEW: TakePos - add hooks complete product display
|
||||
NEW: TakePos - add hooks for cart display
|
||||
NEW: TakePos - add hooks to complete ajax return array
|
||||
NEW: Add hook before the public ticket list
|
||||
NEW: Add hook doaction in takepos invoice
|
||||
NEW: Add Hook for Notif
|
||||
NEW: Add hook for more buttons
|
||||
NEW: Add hook printFieldListWhere in "show_contacts" function
|
||||
NEW: Add hook printFieldWhere in load_state_board function
|
||||
NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
|
||||
NEW: Add hook selectProductsListWhere in select_produits_list function
|
||||
NEW: Add hooks in commercial index
|
||||
NEW: Add hooks in customers and products boxes
|
||||
NEW: Add hooks in thirdparty index page
|
||||
NEW: Add hooks on project task time page
|
||||
NEW: Add hooks on salaries and sociales card
|
||||
NEW: Add hooks select product list and select thirdparty list function
|
||||
NEW: Add hook to getSellPrice function
|
||||
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
@ -41,6 +197,105 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions.
|
||||
* The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.2 compared to 15.0.1 *****
|
||||
|
||||
FIX: #19777 #20281
|
||||
FIX: #20140 #20301
|
||||
FIX: #20279 Accountancy - PostGreSQL - Error on mass update lines already binded
|
||||
FIX: #20476 migration postgresql 14.0.x to 15.0.x packaging type
|
||||
FIX: #20733 Inventory: Do not use batch qty even if present if batch module is disabled.
|
||||
FIX: action comm list: holiday last day not included + handle duration with halfdays
|
||||
FIX: Add missing entity on salary's payment
|
||||
FIX: Add 'recruitment' into check array
|
||||
FIX: add tools to fix bad bank amount in accounting with multicurrency
|
||||
FIX: assign member cateogry to a member
|
||||
FIX: backport
|
||||
FIX: bad bank amount in accounting with multicurrency
|
||||
FIX: Bad condition on remx
|
||||
FIX: Bad filter on date on salary list
|
||||
FIX: bad link to add a customer price (token duplicated)
|
||||
FIX: bad status of member on widget by type and status
|
||||
FIX: better error management at product selling price update
|
||||
FIX: Can't edit bank record
|
||||
FIX: check mandatory thirdparty fields for mass action
|
||||
FIX: check thirdparty object loaded and properties exist
|
||||
FIX: comment
|
||||
FIX: compatibility for ticket number sharing
|
||||
FIX: compatibility with multicompany sharings
|
||||
FIX: contact card: single extrafield update failed
|
||||
FIX: country not visible into list of states
|
||||
FIX: Delete an extrafield where type is double
|
||||
FIX: deprecated module are not more viewed as external modules
|
||||
FIX: Disable customer type by default if type prospect/customer is disabled
|
||||
FIX: each time we create a supplier order, we need to give it a ref_supplier
|
||||
FIX: Error management
|
||||
FIX: fatal error for $db usage in tpl
|
||||
FIX: filter into the list of product lots
|
||||
FIX: Filter on Object Referent page give CRSF page
|
||||
FIX: Fix default options ($hidedetails, $hidedesc, $hideref) with globales when generate PDF in mass actions
|
||||
FIX: Fix search by filters
|
||||
FIX: Fix the adding of lines in the create invoice functions
|
||||
FIX: forgotten form confirm before various payment delete
|
||||
FIX: holiday/leave requests: write status change emails in HTML
|
||||
FIX: include discount price for PMP after a reception (Issue #20029)
|
||||
FIX: incrementation
|
||||
FIX: in salary stats and payment list, we must check right perms as well as salary list
|
||||
FIX: intervention entity missing
|
||||
FIX: label tax cat trad
|
||||
FIX: Mass action ship orders
|
||||
FIX: missing advanced perms
|
||||
FIX: missing call to executeHooks()
|
||||
FIX: Missing entity on adding new VAT
|
||||
FIX: missing hook for row ordering
|
||||
FIX: missing hook parameter ($possiblelinks)
|
||||
FIX: missing parenthesis
|
||||
FIX: missing picto in combo of mass actions of thirdparties.
|
||||
FIX: missing signature library when ODT model is used
|
||||
FIX: Missing unset fields after updateline expensereport
|
||||
FIX: ModuileBuilder - Fix getLinesArray() error reporting
|
||||
FIX: Move delete task time trigger position
|
||||
FIX: Navigation between invoices
|
||||
FIX: No empty line inserted into accounting_bookkeeping
|
||||
FIX: Numbering of sepa files
|
||||
FIX: object cloning: set unique extrafield values to null to prevent duplicates
|
||||
FIX: on update with action reminder in future there is user key error
|
||||
FIX: originproductline array td identification data-id
|
||||
FIX: out of memory when more than 100 000 invoices.
|
||||
FIX: permit access to medias when logged in a different entity
|
||||
FIX: phpcs
|
||||
FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted
|
||||
FIX: project timesheet by week: cleanup unused code
|
||||
FIX: project timesheet: public holidays offset by 1 day
|
||||
FIX: project timesheets: assume Saturday and Sunday as default weekend days when working days conf is empty or badly formed
|
||||
FIX: propal list: bad error management when setting "not signed" mass action
|
||||
FIX: propal list mass action translations and error management (v14 edition)
|
||||
FIX: propal list: missing not signed massaction translation keys for transifex
|
||||
FIX: PR returns
|
||||
FIX: ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders
|
||||
FIX: replenish and manage product stock by warhouse
|
||||
FIX: sending email on payment of registration of event
|
||||
FIX: SEPA ICS is not mandatory for bank transfer
|
||||
FIX: Set datec when add time spent on a project task
|
||||
FIX: status filter on supplierOrder stats doesn't work
|
||||
FIX: stickler-ci
|
||||
FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message
|
||||
FIX: Supplier order stats
|
||||
FIX: Tabulation must be allowed for HTML content
|
||||
FIX: tool to fix bank account not in main currency for vendor invoice
|
||||
FIX: translations
|
||||
FIX: Travis + Update dev
|
||||
FIX: truncate Customer Reference too long on PDF header (PR #20718)
|
||||
FIX: uniformize code
|
||||
FIX: Update of sale price (log not correctly updated)
|
||||
FIX: user actions rights when mulit-company transverse mode is enabled
|
||||
FIX: user employee tab: offset in open days messes up holiday length calculation
|
||||
FIX: We need to have a different default_ref_supplier for each new fourn invoice
|
||||
FIX: "WHERE" clause missing on resource export
|
||||
FIX: #yogosha9754
|
||||
|
||||
|
||||
***** ChangeLog for 15.0.1 compared to 15.0.0 *****
|
||||
FIX: #19777 #20281
|
||||
FIX: bad position of extrafields for interventions
|
||||
|
||||
@ -6,8 +6,9 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
||||
|
||||
| Version | Supported |
|
||||
| ---------- | ---------------------- |
|
||||
| <= 14.0.4 | :x: |
|
||||
| >= 14.0.5+ | :white_check_mark: except CSRF attacks|
|
||||
| <= 15.0.0 | :x: |
|
||||
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
|
||||
| >= 16.0.0 | :white_check_mark: |
|
||||
| >= develop | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
@ -27,12 +27,12 @@ OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
|
||||
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
|
||||
SourceDir=..\..\..
|
||||
AppId=doliwamp
|
||||
AppPublisher=NLTechno
|
||||
AppPublisherURL=https://www.nltechno.com
|
||||
AppPublisher=DoliCloud
|
||||
AppPublisherURL=https://www.dolicloud.com
|
||||
AppSupportURL=https://www.dolibarr.org
|
||||
AppUpdatesURL=https://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software.
|
||||
AppCopyright=Copyright (C) 2008-2020 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
@ -99,13 +99,12 @@ Source: "build\exe\doliwamp\startdoliwamp_manual_donotuse.bat.install"; DestDir:
|
||||
Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
|
||||
|
||||
; PhpMyAdmin, Apache, Php, Mysql
|
||||
; Apache, Php, Mysql
|
||||
; Put here path of Wampserver applications
|
||||
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
|
||||
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
|
||||
; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
|
||||
; Value OK: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe)
|
||||
Source: "C:\wamp64\apps\phpmyadmin4.9.2\*.*"; DestDir: "{app}\apps\phpmyadmin4.9.2"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
|
||||
;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||
;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||
@ -125,9 +124,7 @@ Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversi
|
||||
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
|
||||
|
||||
; Config files
|
||||
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion;
|
||||
;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion;
|
||||
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
|
||||
@ -196,7 +193,6 @@ var destFileA: String;
|
||||
var srcContents: String;
|
||||
var browser: String;
|
||||
var mysqlVersion: String;
|
||||
var phpmyadminVersion: String;
|
||||
var phpDllCopy: String;
|
||||
var batFile: String;
|
||||
|
||||
@ -246,7 +242,6 @@ begin
|
||||
phpVersion := '7.3.12' ;
|
||||
//mysqlVersion := '5.0.45';
|
||||
mysqlVersion := '10.4.10';
|
||||
phpmyadminVersion := '4.1.14';
|
||||
|
||||
smtpServer := 'localhost';
|
||||
apachePort := '80';
|
||||
@ -635,27 +630,6 @@ begin
|
||||
begin
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file alias phpmyadmin (always)
|
||||
//----------------------------------------------
|
||||
|
||||
destFile := pathWithSlashes+'/alias/phpmyadmin.conf';
|
||||
srcFile := pathWithSlashes+'/alias/phpmyadmin.conf.install';
|
||||
|
||||
if FileExists(srcFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
|
||||
//installDir et version de phpmyadmin
|
||||
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
|
||||
StringChangeEx (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion, True);
|
||||
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end;
|
||||
DeleteFile(srcFile);
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file alias dolibarr (if not exists)
|
||||
//----------------------------------------------
|
||||
@ -691,35 +665,6 @@ begin
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file configuration for phpmyadmin (if not exists)
|
||||
//----------------------------------------------
|
||||
|
||||
destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
|
||||
srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
|
||||
|
||||
if FileExists(srcFile) then
|
||||
begin
|
||||
if not FileExists (destFile) then
|
||||
begin
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// We must replace to use format 2.4 of apache
|
||||
DeleteFile(destFile);
|
||||
LoadStringFromFile (srcFile, srcContents);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
|
||||
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
|
||||
SaveStringToFile(destFile,srcContents, False);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Create file httpd.conf (if not exists)
|
||||
//----------------------------------------------
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*spl_autoload_register(function ($class_name) {
|
||||
var_dump('class='.$class_name);
|
||||
//var_dump('class='.$class_name);
|
||||
require $class_name;
|
||||
});
|
||||
*/
|
||||
|
||||
@ -47,7 +47,8 @@ $main_option = array(
|
||||
'ACCOUNTING_EXPORT_PREFIX_SPEC',
|
||||
);
|
||||
|
||||
$configuration = AccountancyExport::getTypeConfig();
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$configuration = $accountancyexport->getTypeConfig();
|
||||
|
||||
$listparam = $configuration['param'];
|
||||
|
||||
@ -117,7 +118,7 @@ if ($action == 'update') {
|
||||
|
||||
if (!$error) {
|
||||
// reload
|
||||
$configuration = AccountancyExport::getTypeConfig();
|
||||
$configuration = $accountancyexport->getTypeConfig();
|
||||
$listparam = $configuration['param'];
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -237,7 +238,7 @@ if (!$conf->use_javascript_ajax) {
|
||||
print "</td>";
|
||||
} else {
|
||||
print '<td>';
|
||||
$listmodelcsv = AccountancyExport::getType();
|
||||
$listmodelcsv = $accountancyexport->getType();
|
||||
print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
|
||||
print '</td>';
|
||||
|
||||
@ -395,8 +395,8 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
@ -406,9 +406,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
@ -608,7 +608,7 @@ if ($result) {
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Ref produit as link
|
||||
$product_static->ref = $obj->ref;
|
||||
@ -891,7 +891,7 @@ if ($result) {
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ if ($action != 'export_csv') {
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$nrows = $db->num_rows($resql);
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
|
||||
@ -204,7 +204,8 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
unset($arrayfields['t.lettering_code']);
|
||||
}
|
||||
|
||||
$listofformat = AccountancyExport::getType();
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$listofformat = $accountancyexport->getType();
|
||||
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
|
||||
if (empty($listofformat[$formatexportset])) {
|
||||
$formatexportset = 1;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr>
|
||||
* Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de>
|
||||
*
|
||||
* 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
|
||||
@ -34,6 +35,7 @@
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -93,11 +95,13 @@ class AccountancyExport
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$this->db = $db;
|
||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
|
||||
|
||||
$hookmanager->initHooks(array('accountancyexport'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,7 +109,7 @@ class AccountancyExport
|
||||
*
|
||||
* @return array of type
|
||||
*/
|
||||
public static function getType()
|
||||
public function getType()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -132,6 +136,10 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
|
||||
);
|
||||
|
||||
// allow modules to define export formats
|
||||
global $hookmanager;
|
||||
$reshook = $hookmanager->executeHooks('getType', $parameters, $listofexporttypes);
|
||||
|
||||
ksort($listofexporttypes, SORT_NUMERIC);
|
||||
|
||||
return $listofexporttypes;
|
||||
@ -168,7 +176,12 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
|
||||
);
|
||||
|
||||
return $formatcode[$type];
|
||||
global $hookmanager;
|
||||
$code = $formatcode[$type];
|
||||
$parameters = array('type' => $type);
|
||||
$reshook = $hookmanager->executeHooks('getFormatCode', $parameters, $code);
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,11 +189,11 @@ class AccountancyExport
|
||||
*
|
||||
* @return array of type
|
||||
*/
|
||||
public static function getTypeConfig()
|
||||
public function getTypeConfig()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
return array(
|
||||
$exporttypes = array(
|
||||
'param' => array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => array(
|
||||
'label' => $langs->trans('Modelcsv_configurable'),
|
||||
@ -265,6 +278,11 @@ class AccountancyExport
|
||||
'txt' => $langs->trans("txt")
|
||||
),
|
||||
);
|
||||
|
||||
global $hookmanager;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('getTypeConfig', $parameters, $exporttypes);
|
||||
return $exporttypes;
|
||||
}
|
||||
|
||||
|
||||
@ -350,7 +368,13 @@ class AccountancyExport
|
||||
$this->exportiSuiteExpert($TData);
|
||||
break;
|
||||
default:
|
||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||
global $hookmanager;
|
||||
$parameters = array('format' => $formatexportset);
|
||||
// file contents will be created in the hooked function via print
|
||||
$reshook = $hookmanager->executeHooks('export', $parameters, $TData);
|
||||
if ($reshook != 1) {
|
||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,11 +586,11 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ' WHERE a.rowid = ' . ((int) $id);
|
||||
|
||||
dol_syslog(get_class($this) . '::info sql=' . $sql);
|
||||
$result = $this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
@ -605,7 +605,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject
|
||||
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (empty($reshook)) {
|
||||
$const_name = '';
|
||||
if ($type == 'customer') {
|
||||
$const_name = "SOLD";
|
||||
} elseif ($type == 'supplier') {
|
||||
|
||||
@ -1883,7 +1883,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
|
||||
@ -266,14 +266,14 @@ class Lettering extends BookKeeping
|
||||
$sql .= " ORDER BY ab2.lettering_code DESC";
|
||||
$sql .= " LIMIT 1 ";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$resqla = $this->db->query($sql);
|
||||
if ($resqla) {
|
||||
$obj = $this->db->fetch_object($resqla);
|
||||
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||
if (!empty($obj->lettering_code)) {
|
||||
$lettre++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$this->db->free($resqla);
|
||||
} else {
|
||||
$this->errors[] = 'Error'.$this->db->lasterror();
|
||||
$error++;
|
||||
@ -281,14 +281,14 @@ class Lettering extends BookKeeping
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$resqlb = $this->db->query($sql);
|
||||
if ($resqlb) {
|
||||
$obj = $this->db->fetch_object($resqlb);
|
||||
if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
|
||||
$error++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$this->db->free($resqlb);
|
||||
} else {
|
||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();
|
||||
$error++;
|
||||
@ -699,6 +699,8 @@ class Lettering extends BookKeeping
|
||||
return $grouped_payments;
|
||||
}
|
||||
|
||||
$save_payment_by_element = null;
|
||||
$save_element_by_payment = null;
|
||||
if ($element_id == 0) {
|
||||
// Save list when is the begin of recursive function
|
||||
$save_payment_by_element = $payment_by_element;
|
||||
|
||||
@ -558,11 +558,11 @@ if ($result) {
|
||||
}
|
||||
|
||||
|
||||
/*var_dump($tabpay);
|
||||
var_dump($tabcompany);
|
||||
var_dump($tabbq);
|
||||
var_dump($tabtp);
|
||||
var_dump($tabtype);*/
|
||||
//var_dump($tabpay);
|
||||
//var_dump($tabcompany);
|
||||
//var_dump($tabbq);
|
||||
//var_dump($tabtp);
|
||||
//var_dump($tabtype);
|
||||
|
||||
// Write bookkeeping
|
||||
if (!$error && $action == 'writebookkeeping') {
|
||||
@ -594,9 +594,9 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$db->begin();
|
||||
|
||||
// Introduce a protection. Total of tabtp must be total of tabbq
|
||||
/*var_dump($tabpay);
|
||||
var_dump($tabtp);
|
||||
var_dump($tabbq);exit;*/
|
||||
//var_dump($tabpay);
|
||||
//var_dump($tabtp);
|
||||
//var_dump($tabbq);exit;
|
||||
|
||||
// Bank
|
||||
if (!$errorforline && is_array($tabbq[$key])) {
|
||||
@ -1267,9 +1267,9 @@ if (empty($action) || $action == 'view') {
|
||||
$accounttoshowsubledger = length_accounta($k);
|
||||
if ($accounttoshow != $accounttoshowsubledger) {
|
||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
|
||||
/*var_dump($tabpay[$key]);
|
||||
var_dump($tabtype[$key]);
|
||||
var_dump($tabbq[$key]);*/
|
||||
//var_dump($tabpay[$key]);
|
||||
//var_dump($tabtype[$key]);
|
||||
//var_dump($tabbq[$key]);
|
||||
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
if (!empty($tabcompany[$key]['code_compta'])) {
|
||||
if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {
|
||||
|
||||
@ -43,17 +43,6 @@ if ($in_bookkeeping == '') {
|
||||
$in_bookkeeping = 'notyet';
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Get information of journal
|
||||
$object = new AccountingJournal($db);
|
||||
$result = $object->fetch($id_journal);
|
||||
@ -65,7 +54,7 @@ if ($result > 0) {
|
||||
accessforbidden($langs->trans('ErrorRecordNotFound'));
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('globaljournal', $object->nature_text . 'journal'));
|
||||
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
|
||||
$parameters = array();
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
@ -93,6 +82,18 @@ if (!is_array($journal_data)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
@ -64,7 +64,7 @@ if ($action == 'set_default') {
|
||||
} elseif ($action == 'del_default') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") {
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
|
||||
dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
|
||||
}
|
||||
}
|
||||
@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
|
||||
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
|
||||
}
|
||||
print '<td>';
|
||||
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
|
||||
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
|
||||
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
|
||||
if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
|
||||
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
|
||||
}
|
||||
print '</td>';
|
||||
@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print '<td class="center">';
|
||||
if ($conf->global->MEMBER_ADDON_PDF == $name) {
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) {
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -95,12 +95,13 @@ if ($action == 'update') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("MembersSetup");
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $langs->trans("MembersSetup"), $help_url);
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
|
||||
print load_fiche_titre($title, $linkback, 'title_setup');
|
||||
|
||||
$head = member_admin_prepare_head();
|
||||
|
||||
|
||||
@ -2030,7 +2030,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
$MAX = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
@ -121,6 +121,9 @@ class AdherentType extends CommonObject
|
||||
/** @var array Array of members */
|
||||
public $members = array();
|
||||
|
||||
/** @var string string other */
|
||||
public $other = array();
|
||||
|
||||
public $multilangs = array();
|
||||
|
||||
|
||||
|
||||
@ -490,17 +490,17 @@ class Subscription extends CommonObject
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
|
||||
$sql .= ' WHERE c.rowid = '.((int) $id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
@ -99,12 +99,12 @@ $sql .= " WHERE t.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||
|
||||
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$adhtype = new AdherentType($db);
|
||||
$adhtype->id = $objp->rowid;
|
||||
@ -127,7 +127,7 @@ if ($result) {
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
@ -143,16 +143,16 @@ $sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -305,6 +305,8 @@ $formother = new FormOther($db);
|
||||
$membertypestatic = new AdherentType($db);
|
||||
$memberstatic = new Adherent($db);
|
||||
|
||||
$title = $langs->trans("Members");
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
||||
@ -471,42 +473,41 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$titre = $langs->trans("MembersList");
|
||||
if (GETPOSTISSET("search_status")) {
|
||||
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
|
||||
$titre = $langs->trans("MembersListQualified");
|
||||
$title = $langs->trans("MembersListQualified");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_DRAFT) {
|
||||
$titre = $langs->trans("MembersListToValid");
|
||||
$title = $langs->trans("MembersListToValid");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
|
||||
$titre = $langs->trans("MenuMembersValidated");
|
||||
$title = $langs->trans("MenuMembersValidated");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
|
||||
$titre = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
$title = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
|
||||
$titre = $langs->trans("MembersListUpToDate");
|
||||
$title = $langs->trans("MembersListUpToDate");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
|
||||
$titre = $langs->trans("MembersListNotUpToDate");
|
||||
$title = $langs->trans("MembersListNotUpToDate");
|
||||
}
|
||||
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
|
||||
$titre = $langs->trans("MembersListResiliated");
|
||||
$title = $langs->trans("MembersListResiliated");
|
||||
}
|
||||
if ($search_status == Adherent::STATUS_EXCLUDED) {
|
||||
$titre = $langs->trans("MembersListExcluded");
|
||||
$title = $langs->trans("MembersListExcluded");
|
||||
}
|
||||
} elseif ($action == 'search') {
|
||||
$titre = $langs->trans("MembersListQualified");
|
||||
$title = $langs->trans("MembersListQualified");
|
||||
}
|
||||
|
||||
if ($search_type > 0) {
|
||||
$membertype = new AdherentType($db);
|
||||
$result = $membertype->fetch($search_type);
|
||||
$titre .= " (".$membertype->label.")";
|
||||
$title .= " (".$membertype->label.")";
|
||||
}
|
||||
|
||||
$param = '';
|
||||
@ -623,7 +624,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
$topicmail = "Information";
|
||||
$modelmail = "member";
|
||||
|
||||
@ -1067,12 +1067,12 @@ if ($rowid > 0) {
|
||||
// Bank account
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
|
||||
print img_picto('', 'bank_account');
|
||||
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
|
||||
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Payment mode
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Date of payment
|
||||
|
||||
@ -173,6 +173,9 @@ if (!empty($triggers)) {
|
||||
if ($module == 'contact') {
|
||||
$module = 'societe';
|
||||
}
|
||||
if ($module == 'facturerec') {
|
||||
$module = 'facture';
|
||||
}
|
||||
|
||||
// If 'element' value is myobject@mymodule instead of mymodule
|
||||
$tmparray = explode('@', $module);
|
||||
|
||||
@ -225,7 +225,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
|
||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
|
||||
@ -272,7 +272,7 @@ $tabsqlsort[24] = "code ASC, label ASC";
|
||||
$tabsqlsort[25] = "t.module ASC, t.code ASC, t.label ASC";
|
||||
//$tabsqlsort[26]="code ASC";
|
||||
$tabsqlsort[27] = "code ASC";
|
||||
$tabsqlsort[28] = "country ASC, code ASC";
|
||||
$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
|
||||
$tabsqlsort[29] = "position ASC";
|
||||
$tabsqlsort[30] = "code ASC";
|
||||
//$tabsqlsort[31]="pcg_version ASC";
|
||||
@ -319,7 +319,7 @@ $tabfield[24] = "code,label";
|
||||
$tabfield[25] = "code,label";
|
||||
//$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27] = "code,libelle,picto";
|
||||
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative";
|
||||
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
|
||||
$tabfield[29] = "code,label,percent,position";
|
||||
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfield[31]= "pcg_version,label";
|
||||
@ -366,7 +366,7 @@ $tabfieldvalue[24] = "code,label";
|
||||
$tabfieldvalue[25] = "code,label";
|
||||
//$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27] = "code,libelle,picto";
|
||||
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative";
|
||||
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
|
||||
$tabfieldvalue[29] = "code,label,percent,position";
|
||||
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfieldvalue[31]= "pcg_version,label";
|
||||
@ -413,7 +413,7 @@ $tabfieldinsert[24] = "code,label";
|
||||
$tabfieldinsert[25] = "code,label";
|
||||
//$tabfieldinsert[26]= "code,label,short_label";
|
||||
$tabfieldinsert[27] = "code,libelle,picto";
|
||||
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative";
|
||||
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
|
||||
$tabfieldinsert[29] = "code,label,percent,position";
|
||||
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfieldinsert[31]= "pcg_version,label";
|
||||
@ -585,6 +585,10 @@ complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqls
|
||||
$i = 0;
|
||||
foreach ($tabcomplete as $key => $value) {
|
||||
$i++;
|
||||
// When a dictionnary is commented
|
||||
if (!isset($tabcond[$i])) {
|
||||
continue;
|
||||
}
|
||||
$tabcomplete[$key]['id'] = $i;
|
||||
$tabcomplete[$key]['cond'] = $tabcond[$i];
|
||||
$tabcomplete[$key]['rowid'] = $tabrowid[$i];
|
||||
@ -607,7 +611,7 @@ if (empty($sortfield)) {
|
||||
$tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']);
|
||||
$tmp2 = explode(' ', $tmp1[0]);
|
||||
$sortfield = preg_replace('/^.*\./', '', $tmp2[0]);
|
||||
$sortorder = $tmp2[1];
|
||||
$sortorder = (!empty($tmp2[1]) ? $tmp2[1] : '');
|
||||
//var_dump($sortfield);var_dump($sortorder);
|
||||
}
|
||||
|
||||
|
||||
@ -420,7 +420,7 @@ if (!empty($moreforfilter)) {
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
|
||||
@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
|
||||
$error = 0;
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ikoffset = GETPOST('ikoffset', 'int');
|
||||
$coef = GETPOST('coef', 'int');
|
||||
|
||||
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||
$fk_range = GETPOST('fk_range', 'int');
|
||||
|
||||
@ -62,9 +62,16 @@ if ($action == 'updateik') {
|
||||
}
|
||||
}
|
||||
|
||||
$expIk->setValues($_POST);
|
||||
$result = $expIk->create($user);
|
||||
$expIk->coef = $coef;
|
||||
$expIk->ikoffset = $ikoffset;
|
||||
$expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
|
||||
$expIk->fk_range = $fk_range;
|
||||
|
||||
if ($expIk->id > 0) {
|
||||
$result = $expIk->update($user);
|
||||
} else {
|
||||
$result = $expIk->create($user);
|
||||
}
|
||||
if ($result > 0) {
|
||||
setEventMessages('SetupSaved', null, 'mesgs');
|
||||
|
||||
|
||||
@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
|
||||
|
||||
$object = new ExpenseReportRule($db);
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -51,7 +57,6 @@ if ($reshook < 0) {
|
||||
if (empty($reshook)) {
|
||||
//Init error
|
||||
$error = false;
|
||||
$message = false;
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -59,21 +64,20 @@ if (empty($reshook)) {
|
||||
$apply_to = GETPOST('apply_to');
|
||||
$fk_user = GETPOST('fk_user', 'int');
|
||||
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
||||
|
||||
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
$restrictive = GETPOST('restrictive', 'int');
|
||||
$fk_c_type_fees = GETPOST('fk_c_type_fees', 'int');
|
||||
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
||||
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
||||
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$amount = GETPOST('amount');
|
||||
$amount = price2num(GETPOST('amount'), 'MT', 2);
|
||||
|
||||
$object = new ExpenseReportRule($db);
|
||||
if (!empty($id)) {
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0) {
|
||||
dol_print_error('', $object->error, $object->errors);
|
||||
}
|
||||
}
|
||||
// TODO do action
|
||||
|
||||
if ($action == 'save') {
|
||||
$error = 0;
|
||||
|
||||
@ -104,8 +108,6 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$object->setValues($_POST);
|
||||
|
||||
if ($apply_to == 'U') {
|
||||
$object->fk_user = (int) $fk_user;
|
||||
$object->fk_usergroup = 0;
|
||||
@ -122,18 +124,30 @@ if (empty($reshook)) {
|
||||
|
||||
$object->dates = $dates;
|
||||
$object->datee = $datee;
|
||||
|
||||
$object->restrictive = $restrictive;
|
||||
$object->fk_c_type_fees = $fk_c_type_fees;
|
||||
$object->code_expense_rules_type = $code_expense_rules_type;
|
||||
$object->amount = $amount;
|
||||
$object->entity = $conf->entity;
|
||||
|
||||
$res = $object->create($user);
|
||||
if ($object->id > 0) {
|
||||
$res = $object->update($user);
|
||||
} else {
|
||||
$res = $object->create($user);
|
||||
}
|
||||
if ($res > 0) {
|
||||
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
||||
} else {
|
||||
dol_print_error($object->db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
if (!$error) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'delete') {
|
||||
// TODO add confirm
|
||||
@ -207,7 +221,7 @@ if ($action != 'edit') {
|
||||
echo '<td class="linecoltyperule">' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '</td>';
|
||||
echo '<td class="linecoldatestart">' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '</td>';
|
||||
echo '<td class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
|
||||
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
|
||||
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount right" /></td>';
|
||||
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
|
||||
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
|
||||
echo '</tr>';
|
||||
@ -304,10 +318,10 @@ foreach ($rules as $rule) {
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
// Amount
|
||||
echo '<td class="linecolamount">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
|
||||
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount width50 right" />';
|
||||
} else {
|
||||
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
}
|
||||
|
||||
@ -442,23 +442,23 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
*/
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
|
||||
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
|
||||
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
|
||||
}
|
||||
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
|
||||
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
|
||||
}
|
||||
/*
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
*/
|
||||
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
|
||||
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
|
||||
|
||||
|
||||
// Set working days
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -101,9 +101,14 @@ if ($action == 'update') {
|
||||
if ($mode == 'template') {
|
||||
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
/*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
|
||||
if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
|
||||
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||
if (!$val) {
|
||||
dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
||||
} else {
|
||||
dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
|
||||
if ($val == '') {
|
||||
|
||||
@ -57,6 +57,7 @@ $langs->loadLangs($langsArray);
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@ -619,15 +620,17 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
if (!empty($search) && is_array($search)) {
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
}
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
|
||||
@ -529,7 +529,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
|
||||
@ -78,7 +78,7 @@ print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td></td>';
|
||||
|
||||
|
||||
@ -106,6 +106,15 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
|
||||
print '<td class="right">';
|
||||
@ -122,15 +131,7 @@ echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
|
||||
print '<td class="right">';
|
||||
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -74,7 +74,6 @@ llxHeader('', $langs->trans("ResourceSetup"));
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ResourceSetup"), $linkback, 'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head = resource_admin_prepare_head();
|
||||
|
||||
|
||||
@ -407,10 +407,10 @@ if (empty($error) && !empty($xml)) {
|
||||
$checksumget = md5(join(',', $checksumconcat));
|
||||
$checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
|
||||
|
||||
/*var_dump(count($file_list['added']));
|
||||
var_dump($checksumget);
|
||||
var_dump($checksumtoget);
|
||||
var_dump($checksumget == $checksumtoget);*/
|
||||
//var_dump(count($file_list['added']));
|
||||
//var_dump($checksumget);
|
||||
//var_dump($checksumtoget);
|
||||
//var_dump($checksumget == $checksumtoget);
|
||||
|
||||
$resultcomment = '';
|
||||
|
||||
|
||||
@ -58,23 +58,6 @@ print $langs->trans("xcache.optimizer").': '.yn(ini_get('xcache.optimizer')).' (
|
||||
print $langs->trans("xcache.stat").': '.yn(ini_get('xcache.stat')).'<br>'."\n";
|
||||
print $langs->trans("xcache.coverager").': '.yn(ini_get('xcache.coverager')).'<br>'."\n";
|
||||
|
||||
//print xcache_get();
|
||||
/*
|
||||
$cacheinfos = array();
|
||||
for ($i = 0; $i < 10; $i ++)
|
||||
{
|
||||
$data = xcache_info(XC_TYPE_PHP, $i);
|
||||
$data['cacheid'] = $i;
|
||||
$cacheinfos[] = $data;
|
||||
}
|
||||
|
||||
var_dump($cacheinfos);
|
||||
|
||||
if ($action == 'clear')
|
||||
{
|
||||
xcache_clear_cache();
|
||||
}
|
||||
*/
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -42,21 +42,24 @@ $label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scandir', 'alpha');
|
||||
$type = 'ticket';
|
||||
|
||||
$error = 0;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$error = 0;
|
||||
$errors = array();
|
||||
|
||||
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
|
||||
if (GETPOST('value')) {
|
||||
dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
|
||||
} else {
|
||||
dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setvar') {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
} elseif ($action == 'setvar') {
|
||||
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
|
||||
if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
|
||||
@ -64,14 +67,7 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('TICKET_EMAIL_MUST_EXISTS')) { // only for no js case
|
||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +76,7 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +85,7 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,6 +97,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
|
||||
@ -109,6 +108,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
|
||||
@ -119,6 +119,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
|
||||
@ -129,6 +130,7 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
|
||||
@ -139,12 +141,14 @@ if ($action == 'setvar') {
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
$param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
@ -152,10 +156,60 @@ if ($action == 'setvar') {
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
|
||||
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
|
||||
$res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
} elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
|
||||
$res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
|
||||
// enable captcha by default
|
||||
$res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA', 1, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
$errors[] = $db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action != '') {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('SetupSaved'));
|
||||
header("Location: " . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages('', $errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -180,7 +234,7 @@ $head = ticketAdminPrepareHead();
|
||||
|
||||
print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php?entity='.$conf->entity.'" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).'</a>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -220,11 +274,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
// Check if email exists
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
|
||||
print '<td class="left">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
|
||||
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center width75">';
|
||||
@ -232,6 +285,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Create third-party with contact if email not linked to a contact
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
|
||||
print '<td class="left">';
|
||||
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||
} else {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center width75">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
// Show logo for module
|
||||
@ -341,7 +408,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print_fiche_titre($langs->trans("Emails"));
|
||||
print load_fiche_titre($langs->trans("Emails"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@ -257,7 +257,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
}
|
||||
if ($execmethod == 1) {
|
||||
// If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
|
||||
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.(GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP') ? ' checked="checked"' : '').'" />';
|
||||
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.((GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP')) ? ' checked="checked"' : '').'" />';
|
||||
print '<label for="lowmemorydump">';
|
||||
print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
|
||||
print '</label>';
|
||||
@ -439,7 +439,7 @@ if (in_array($type, array('pgsql'))) {
|
||||
$prefix = 'pg_dump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall", 'tzuser').'.'.$ext;
|
||||
print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
@ -559,10 +559,10 @@ print '</table>';
|
||||
print "</div> <!-- end div fichehalfleft -->\n";
|
||||
|
||||
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div id="backupdatabaseright" class="fichehalfright">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:480px; overflow: auto;"');
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
@ -594,7 +594,7 @@ print load_fiche_titre($title);
|
||||
print '<label for="zipfilename_template" class="line-height-large paddingbottom">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||
$prefix = 'documents';
|
||||
$ext = 'zip';
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall", 'tzuser');
|
||||
print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
|
||||
print '<br>';
|
||||
|
||||
@ -639,10 +639,10 @@ print '</div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div id="backupfileright" class="fichehalfright" style="height:250px; overflow: auto;">';
|
||||
print '<div id="backupfileright" class="fichehalfright">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow: auto;"');
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -444,9 +444,9 @@ if ($mode == 'overwrite') {
|
||||
|
||||
if ($mode == 'searchkey') {
|
||||
$nbempty = 0;
|
||||
/*var_dump($langcode);
|
||||
var_dump($transkey);
|
||||
var_dump($transvalue);*/
|
||||
//var_dump($langcode);
|
||||
//var_dump($transkey);
|
||||
//var_dump($transvalue);
|
||||
if (empty($langcode) || $langcode == '-1') {
|
||||
$nbempty++;
|
||||
}
|
||||
|
||||
@ -88,9 +88,9 @@ class DolibarrApi
|
||||
// phpcs:enable
|
||||
// TODO Use type detected in $object->fields
|
||||
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
|
||||
return checkVal($value, 'restricthtml');
|
||||
return sanitizeVal($value, 'restricthtml');
|
||||
} else {
|
||||
return checkVal($value, 'alphanohtml');
|
||||
return sanitizeVal($value, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -568,10 +568,9 @@ class Documents extends DolibarrApi
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
/*var_dump($modulepart);
|
||||
var_dump($filename);
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
//var_dump($modulepart);
|
||||
//var_dump($filename);
|
||||
//var_dump($filecontent);exit;
|
||||
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'Modulepart not provided.');
|
||||
|
||||
@ -100,7 +100,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$url = $_SERVER['PHP_SELF'];
|
||||
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
|
||||
$url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO'];
|
||||
$url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
|
||||
}
|
||||
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
|
||||
if (!empty($conf->global->MAIN_NGINX_FIX)) {
|
||||
|
||||
@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
@ -144,6 +144,7 @@ class Asset extends CommonObject
|
||||
public $fk_disposal_type;
|
||||
public $disposal_depreciated;
|
||||
public $disposal_subject_to_vat;
|
||||
public $supplier_invoice_id;
|
||||
public $note_public;
|
||||
public $note_private;
|
||||
public $date_creation;
|
||||
|
||||
@ -105,7 +105,6 @@ class AssetModel extends CommonObject
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1'),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
|
||||
'asset_type' => array('type'=>'smallint', 'label'=>'AssetType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetTypeIntangible', '1'=>'AssetTypeTangible', '2'=>'AssetTypeInProgress', '3'=>'AssetTypeFinancial'), 'validate'=>'1',),
|
||||
'fk_pays' =>array('type'=>'integer:Ccountry:core/class/ccountry.class.php', 'label'=>'Country', 'enabled'=>1, 'visible'=>1, 'position'=>50),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>300, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>301, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
||||
@ -129,6 +128,7 @@ class AssetModel extends CommonObject
|
||||
public $import_key;
|
||||
public $model_pdf;
|
||||
public $status;
|
||||
public $asset_depreciation_options;
|
||||
|
||||
// /**
|
||||
// * @var string Field with ID of parent key if this object has a parent
|
||||
|
||||
@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -80,8 +80,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/model/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -68,9 +68,9 @@ if (empty($action) && empty($id) && empty($ref)) {
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $permissiontoadd; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
@ -315,7 +315,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// $MAXEVENT = 10;
|
||||
//
|
||||
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
|
||||
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
|
||||
//
|
||||
// // List of actions on element
|
||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
|
||||
@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -121,9 +121,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write)));
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->delete)));
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete)));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->asset->enabled)) {
|
||||
@ -131,15 +131,18 @@ if (empty($conf->asset->enabled)) {
|
||||
}
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
$socid = 0; if ($user->socid > 0) $socid = $user->socid;
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->asset->enabled)) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -300,19 +303,20 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
/* The slow method does not consume memory on mysql (not tested on pgsql) */
|
||||
/*$resql = $db->query($sql, 0, 'auto', 1);
|
||||
while ($db->fetch_object($resql)) {
|
||||
$nbtotalofrecords++;
|
||||
}*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
|
||||
@ -50,8 +50,8 @@ if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
|
||||
@ -92,11 +92,11 @@ function formatObject($objtoshow, $prefix)
|
||||
$s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
|
||||
$s .= '<td>';
|
||||
if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
|
||||
/*var_dump(is_object($val));
|
||||
var_dump(is_array($val));
|
||||
var_dump(is_array($val));
|
||||
var_dump(@get_class($val));
|
||||
var_dump($val);*/
|
||||
//var_dump(is_object($val));
|
||||
//var_dump(is_array($val));
|
||||
//var_dump(is_array($val));
|
||||
//var_dump(@get_class($val));
|
||||
//var_dump($val);
|
||||
$s .= dol_print_date($val, 'dayhour');
|
||||
} else {
|
||||
$s .= $val;
|
||||
|
||||
@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
|
||||
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
|
||||
}
|
||||
|
||||
// Security check - Protection if external user
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp", "other"));
|
||||
@ -581,47 +583,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Show all the sub bom lines
|
||||
$("#show_all").click(function() {
|
||||
console.log("We click on show all");
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Hide all the sub bom lines
|
||||
$("#hide_all").click(function() {
|
||||
console.log("We click on hide all");
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
print mrpCollapseBomManagement();
|
||||
}
|
||||
|
||||
|
||||
@ -742,7 +705,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
@ -104,6 +104,7 @@ $form = new Form($db);
|
||||
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
|
||||
|
||||
$help_url = 'EN:Module_BOM';
|
||||
$morehtmlref = "";
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
@ -184,7 +185,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
|
||||
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
|
||||
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
|
||||
|
||||
print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');
|
||||
|
||||
@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
|
||||
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
|
||||
}
|
||||
|
||||
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
@ -916,27 +916,27 @@ class BOM extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
if (!empty($obj->fk_user_author)) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
if (!empty($obj->fk_user_valid)) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture) {
|
||||
if (!empty($obj->fk_user_cloture)) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
|
||||
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
@ -1134,6 +1134,9 @@ class BOM extends CommonObject
|
||||
if (! empty($line->childBom)) {
|
||||
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
|
||||
} else {
|
||||
if (empty($TNetNeeds[$line->fk_product])) {
|
||||
$TNetNeeds[$line->fk_product] = 0;
|
||||
}
|
||||
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,3 +136,55 @@ function bomPrepareHead($object)
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage collapse bom display
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function mrpCollapseBomManagement()
|
||||
{
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
// When clicking on collapse
|
||||
$(".collapse_bom").click(function() {
|
||||
console.log("We click on collapse");
|
||||
var id_bom_line = $(this).attr('id').replace('collapse-', '');
|
||||
console.log($(this).html().indexOf('folder-open'));
|
||||
if($(this).html().indexOf('folder-open') <= 0) {
|
||||
$('[parentid="'+ id_bom_line +'"]').show();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Show all the sub bom lines
|
||||
$("#show_all").click(function() {
|
||||
console.log("We click on show all");
|
||||
$("[class^=sub_bom_lines]").show();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
// To Hide all the sub bom lines
|
||||
$("#hide_all").click(function() {
|
||||
console.log("We click on hide all");
|
||||
$("[class^=sub_bom_lines]").hide();
|
||||
$("[class^=collapse_bom]").html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @todo Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
protected $MAP_CAT_FK = array(
|
||||
public $MAP_CAT_FK = array(
|
||||
'customer' => 'soc',
|
||||
'supplier' => 'soc',
|
||||
'contact' => 'socpeople',
|
||||
@ -125,7 +125,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
protected $MAP_CAT_TABLE = array(
|
||||
public $MAP_CAT_TABLE = array(
|
||||
'customer' => 'societe',
|
||||
'supplier' => 'fournisseur',
|
||||
'bank_account'=> 'account',
|
||||
@ -136,7 +136,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
protected $MAP_OBJ_CLASS = array(
|
||||
public $MAP_OBJ_CLASS = array(
|
||||
'product' => 'Product',
|
||||
'customer' => 'Societe',
|
||||
'supplier' => 'Fournisseur',
|
||||
@ -178,7 +178,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @note Move to const array when PHP 5.6 will be our minimum target
|
||||
*/
|
||||
protected $MAP_OBJ_TABLE = array(
|
||||
public static $MAP_OBJ_TABLE = array(
|
||||
'customer' => 'societe',
|
||||
'supplier' => 'societe',
|
||||
'member' => 'adherent',
|
||||
@ -258,6 +258,12 @@ class Categorie extends CommonObject
|
||||
*/
|
||||
public $motherof = array();
|
||||
|
||||
/**
|
||||
* @var array Childs
|
||||
*/
|
||||
public $childs = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -913,7 +919,7 @@ class Categorie extends CommonObject
|
||||
|
||||
$categories = array();
|
||||
|
||||
$type = checkVal($type, 'aZ09');
|
||||
$type = sanitizeVal($type, 'aZ09');
|
||||
|
||||
$sub_type = $type;
|
||||
$subcol_name = "fk_".$type;
|
||||
|
||||
@ -102,7 +102,8 @@ if (empty($nosearch)) {
|
||||
print '<td colspan="3">'.$langs->trans("Search").'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven nohover"><td>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.dol_escape_htmltag($catname).'"></td>';
|
||||
print '<td><input type="submit" class="button small" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print '</table></form>';
|
||||
|
||||
|
||||
|
||||
@ -461,6 +461,13 @@ if (empty($reshook) && $action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
// Modify $moreparam so we are sure to see the event we have just created, whatever are the default value of filter on next page.
|
||||
/*$moreparam .= ($moreparam ? '&' : '').'search_actioncode=0';
|
||||
$moreparam .= ($moreparam ? '&' : '').'search_status=-1';
|
||||
$moreparam .= ($moreparam ? '&' : '').'search_filtert='.$object->userownerid;
|
||||
*/
|
||||
$moreparam .= ($moreparam ? '&' : '').'disabledefaultvalues=1';
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
@ -674,7 +681,7 @@ if (empty($reshook) && $action == 'update') {
|
||||
$object->errors[] = $object->error;
|
||||
} else {
|
||||
if ($db->num_rows($resql) > 0) {
|
||||
// already in use
|
||||
// Resource already in use
|
||||
$error++;
|
||||
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@ -853,7 +860,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
|
||||
$object->errors[] = $object->error;
|
||||
} else {
|
||||
if ($db->num_rows($resql) > 0) {
|
||||
// already in use
|
||||
// Resource already in use
|
||||
$error++;
|
||||
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
@ -952,16 +959,17 @@ if ($action == 'create') {
|
||||
console.log("setdatefields");
|
||||
setdatefields();
|
||||
});
|
||||
|
||||
$("#selectcomplete").change(function() {
|
||||
if ($("#selectcomplete").val() == 100)
|
||||
{
|
||||
console.log("we change the complete status - set the doneby");
|
||||
if ($("#selectcomplete").val() == 100) {
|
||||
if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\');
|
||||
}
|
||||
if ($("#selectcomplete").val() == 0)
|
||||
{
|
||||
if ($("#selectcomplete").val() == 0) {
|
||||
$("#doneby").val(-1);
|
||||
}
|
||||
});
|
||||
|
||||
$("#actioncode").change(function() {
|
||||
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||
else $("#dateend").removeClass("fieldrequired");
|
||||
@ -1019,59 +1027,15 @@ if ($action == 'create') {
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td><label for="fullday">'.$langs->trans("EventOnFullDay").'</label></td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'><label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
|
||||
|
||||
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
|
||||
if (GETPOST('datep', 'int', 1)) {
|
||||
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
|
||||
}
|
||||
$datef = ($datef ? $datef : $object->datef);
|
||||
if (GETPOST('datef', 'int', 1)) {
|
||||
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
|
||||
}
|
||||
if (empty($datef) && !empty($datep)) {
|
||||
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
|
||||
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
|
||||
}
|
||||
}
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
|
||||
} else {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print ' <span class="hideonsmartphone"> - </span> ';
|
||||
//print ' - ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
/*print '<tr><td>';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
|
||||
}
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Dev in progress
|
||||
// Recurring event
|
||||
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
|
||||
if ($userepeatevent) {
|
||||
// Repeat
|
||||
print '<tr><td></td><td colspan="3">';
|
||||
//print '<tr><td></td><td colspan="3" class="opacitymedium">';
|
||||
print ' <div class="opacitymedium inline-block">';
|
||||
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
|
||||
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
|
||||
$selectedrecurrulefreq = 'no';
|
||||
$selectedrecurrulebymonthday = '';
|
||||
@ -1120,34 +1084,51 @@ if ($action == 'create') {
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
//print '</td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent = $complete !=='' ? $complete : -1;
|
||||
if (GETPOSTISSET('status')) {
|
||||
$percent = GETPOST('status');
|
||||
} elseif (GETPOSTISSET('percentage')) {
|
||||
$percent = GETPOST('percentage', 'int');
|
||||
} else {
|
||||
if ($complete == '0' || GETPOST("afaire") == 1) {
|
||||
$percent = '0';
|
||||
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
|
||||
$percent = 100;
|
||||
}
|
||||
}
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
|
||||
if (GETPOST('datep', 'int', 1)) {
|
||||
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
|
||||
}
|
||||
$datef = ($datef ? $datef : $object->datef);
|
||||
if (GETPOST('datef', 'int', 1)) {
|
||||
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
|
||||
}
|
||||
if (empty($datef) && !empty($datep)) {
|
||||
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
|
||||
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
|
||||
}
|
||||
}
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap">';
|
||||
/*
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
*/
|
||||
print '</td><td>';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
|
||||
} else {
|
||||
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print ' <span class="hideonsmartphone"> - </span> ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class=""> </td><td></td></tr>';
|
||||
|
||||
// Assigned to
|
||||
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
print '<tr><td class="tdtop nowrap"><span class="fieldrequired">'.$langs->trans("ActionAffectedTo").'</span></td><td>';
|
||||
$listofuserid = array();
|
||||
$listofcontactid = array();
|
||||
$listofotherid = array();
|
||||
@ -1181,6 +1162,29 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent = $complete !=='' ? $complete : -1;
|
||||
if (GETPOSTISSET('status')) {
|
||||
$percent = GETPOST('status');
|
||||
} elseif (GETPOSTISSET('percentage')) {
|
||||
$percent = GETPOST('percentage', 'int');
|
||||
} else {
|
||||
if ($complete == '0' || GETPOST("afaire") == 1) {
|
||||
$percent = '0';
|
||||
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
|
||||
$percent = 100;
|
||||
}
|
||||
}
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
@ -1237,7 +1241,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container">';
|
||||
print img_picto('', 'project', 'class="pictofixedwidth"');
|
||||
print $formproject->select_projects((empty($societe->id) ? '' : $societe->id), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.(empty($societe->id) ? '' : $societe->id).'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">';
|
||||
print '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
@ -1523,6 +1527,7 @@ if ($id > 0) {
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
|
||||
if ($object->type_code != 'AC_OTH_AUTO') {
|
||||
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
|
||||
print $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ? GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto", 0, 0, 0, 1);
|
||||
} else {
|
||||
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
|
||||
@ -1533,40 +1538,19 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td colspan="3" class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'>';
|
||||
print '<label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
|
||||
|
||||
// Date start - end
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
print '</td><td td colspan="3">';
|
||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print ' - ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Dev in progress
|
||||
// Recurring event
|
||||
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
|
||||
if ($userepeatevent) {
|
||||
// Repeat
|
||||
print '<tr><td></td><td colspan="3">';
|
||||
//print '<tr><td></td><td colspan="3">';
|
||||
print ' <div class="opacitymedium inline-block">';
|
||||
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
|
||||
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
|
||||
$selectedrecurrulefreq = 'no';
|
||||
$selectedrecurrulebymonthday = '';
|
||||
@ -1615,19 +1599,37 @@ if ($id > 0) {
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
//print '</td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
||||
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
|
||||
// Date start - end
|
||||
print '<tr><td class="nowrap">';
|
||||
/*print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||
print ' - ';
|
||||
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||
*/
|
||||
print '</td><td td colspan="3">';
|
||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print ' <span class="hideonsmartphone"> - </span> ';
|
||||
if (GETPOST("afaire") == 1) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} elseif (GETPOST("afaire") == 2) {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
} else {
|
||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class=""> </td><td></td></tr>';
|
||||
|
||||
// Assigned to
|
||||
$listofuserid = array(); // User assigned
|
||||
@ -1678,6 +1680,18 @@ if ($id > 0) {
|
||||
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
||||
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
|
||||
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
@ -1786,7 +1800,7 @@ if ($id > 0) {
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||
$doleditor = new DolEditor('note', $object->note_private, '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -1220,11 +1220,14 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (!empty($this->socpeopleassigned)) {
|
||||
$already_inserted = array();
|
||||
foreach (array_keys($this->socpeopleassigned) as $id) {
|
||||
foreach (array_keys($this->socpeopleassigned) as $key => $val) {
|
||||
if (!is_array($val)) { // For backward compatibility when val=id
|
||||
$val = array('id'=>$val);
|
||||
}
|
||||
if (!empty($already_inserted[$val['id']])) continue;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $id).", 0, 0, 0)";
|
||||
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $val['id']).", 0, 0, 0)";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -1598,7 +1601,7 @@ class ActionComm extends CommonObject
|
||||
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->email_subject;
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from);
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to);
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to);
|
||||
if (!empty($this->email_tocc)) {
|
||||
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_tocc);
|
||||
}
|
||||
@ -1621,7 +1624,7 @@ class ActionComm extends CommonObject
|
||||
$label = $langs->trans("ShowAction");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
|
||||
$linkclose .= ' class="'.$classname.' classfortooltip"';
|
||||
/*
|
||||
$hookmanager->initHooks(array('actiondao'));
|
||||
|
||||
@ -49,6 +49,8 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
|
||||
}
|
||||
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$check_holiday = GETPOST('check_holiday', 'int');
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
@ -110,7 +112,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
|
||||
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
|
||||
$pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
|
||||
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
|
||||
$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
|
||||
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
|
||||
$maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW;
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
@ -128,14 +130,11 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
if ($status == '' && !GETPOSTISSET('search_status')) {
|
||||
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
|
||||
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
@ -1191,7 +1190,8 @@ if (count($listofextcals)) {
|
||||
foreach ($icalevents as $icalevent) {
|
||||
//var_dump($icalevent);
|
||||
|
||||
//print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
|
||||
//print $icalevent['SUMMARY'].'->';
|
||||
//var_dump($icalevent);exit;
|
||||
if (!empty($icalevent['RRULE'])) {
|
||||
continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule.
|
||||
}
|
||||
|
||||
@ -45,6 +45,11 @@ $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
if (empty($mode) && preg_match('/show_/', $action)) {
|
||||
@ -54,12 +59,9 @@ $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid",
|
||||
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
|
||||
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
|
||||
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$year = GETPOST("year", 'int');
|
||||
$month = GETPOST("month", 'int');
|
||||
$day = GETPOST("day", 'int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('search_actioncode', 'array')) {
|
||||
@ -68,11 +70,9 @@ if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
$search_id = GETPOST('search_id', 'alpha');
|
||||
$search_title = GETPOST('search_title', 'alpha');
|
||||
$search_note = GETPOST('search_note', 'alpha');
|
||||
@ -83,7 +83,7 @@ $datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int')
|
||||
$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel');
|
||||
$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel');
|
||||
if ($search_status == '' && !GETPOSTISSET('search_status')) {
|
||||
$search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$search_status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
@ -183,7 +183,8 @@ if ($user->socid && $socid) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$mode = 'list'; $massaction = '';
|
||||
$mode = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) {
|
||||
@ -216,7 +217,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$datestart_dtend = '';
|
||||
$dateend_dtstart = '';
|
||||
$dateend_dtend = '';
|
||||
$actioncode = '';
|
||||
$search_status = '';
|
||||
$pid = '';
|
||||
$socid = '';
|
||||
$resourceid = '';
|
||||
$filter = '';
|
||||
$filtert = '';
|
||||
$usergroup = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
@ -261,13 +269,17 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$userstatic = new User($db);
|
||||
$formactions = new FormActions($db);
|
||||
|
||||
$actionstatic = new ActionComm($db);
|
||||
$societestatic = new Societe($db);
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$nav = '';
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
@ -275,7 +287,8 @@ $nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
$title = $langs->trans("Agenda");
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// Define list of all external calendars
|
||||
$listofextcals = array();
|
||||
@ -299,7 +312,7 @@ if ($actioncode != '') {
|
||||
if ($resourceid > 0) {
|
||||
$param .= "&search_resourceid=".urlencode($resourceid);
|
||||
}
|
||||
if ($search_status != '' && $search_status > -1) {
|
||||
if ($search_status != '') {
|
||||
$param .= "&search_status=".urlencode($search_status);
|
||||
}
|
||||
if ($filter) {
|
||||
@ -563,11 +576,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords++;
|
||||
}*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
@ -588,12 +601,6 @@ if (!$resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
$actionstatic = new ActionComm($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
// Local calendar
|
||||
@ -797,44 +804,57 @@ print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['a.id']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['owner']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['c.libelle']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['a.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['a.note']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
if (!empty($arrayfields['a.datep']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['a.datep2']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['a.fk_contact']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['a.fk_element']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -842,18 +862,21 @@ print $hookmanager->resPrint;
|
||||
|
||||
if (!empty($arrayfields['a.datec']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['a.tms']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['a.percent']['checked'])) {
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
$totalarray['nbfield']++;
|
||||
print "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
$now = dol_now();
|
||||
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
|
||||
|
||||
@ -862,8 +885,20 @@ $caction = new CActionComm($db);
|
||||
$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
|
||||
$contactListCache = array();
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
//$savnbfield = $totalarray['nbfield'];
|
||||
//$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Discard auto action if option is on
|
||||
if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') {
|
||||
@ -1080,12 +1115,20 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
||||
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
|
||||
@ -145,7 +144,7 @@ $begin_d = 1;
|
||||
$end_d = 53;
|
||||
|
||||
if ($status == '' && !GETPOSTISSET('search_status')) {
|
||||
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
@ -961,7 +960,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
||||
$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
||||
|
||||
$nextindextouse = count($colorindexused); // At first run, this is 0, so fist user has 0, next 1, ...
|
||||
//if ($username->id && $day==1) var_dump($eventarray);
|
||||
//if ($username->id && $day==1) {
|
||||
//var_dump($eventarray);
|
||||
//}
|
||||
|
||||
// We are in a particular day for $username, now we scan all events
|
||||
foreach ($eventarray as $daykey => $notused) {
|
||||
|
||||
@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
||||
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) {
|
||||
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
|
||||
@ -154,7 +153,7 @@ if ($end_d < $begin_d) {
|
||||
}
|
||||
|
||||
if ($status == '' && !GETPOSTISSET('search_status')) {
|
||||
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
}
|
||||
|
||||
if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
@ -1130,7 +1129,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
|
||||
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
|
||||
$nextindextouse = count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
|
||||
//if ($username->id && $day==1) var_dump($eventarray);
|
||||
//if ($username->id && $day==1) {
|
||||
//var_dump($eventarray);
|
||||
//}
|
||||
|
||||
// We are in a particular day for $username, now we scan all events
|
||||
foreach ($eventarray as $daykey => $notused) {
|
||||
|
||||
@ -634,7 +634,11 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '<td class="right nowrap tddate">'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
|
||||
|
||||
$datem = $db->jdate($objp->tms);
|
||||
print '<td class="right nowrap tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzuserrel');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -725,7 +729,11 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
|
||||
$datem = $db->jdate($objp->dm);
|
||||
print '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzuserrel');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -922,7 +930,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
|
||||
$datem = $db->jdate($obj->dp);
|
||||
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzserver');
|
||||
print '</td>';
|
||||
print '<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>';
|
||||
|
||||
@ -1039,7 +1050,11 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dv), 'day').'</td>';
|
||||
$datem = $db->jdate($obj->dv);
|
||||
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("DateValue").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
|
||||
print dol_print_date($datem, 'day', 'tzserver');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>';
|
||||
|
||||
|
||||
@ -961,7 +961,7 @@ if ($action == 'create') {
|
||||
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
|
||||
print "\n\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) {
|
||||
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print dol_set_focus('#sendto');
|
||||
dol_set_focus('#sendto');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -86,6 +86,11 @@ class Mailing extends CommonObject
|
||||
*/
|
||||
public $email_from;
|
||||
|
||||
/**
|
||||
* @var string email to
|
||||
*/
|
||||
public $sendto;
|
||||
|
||||
/**
|
||||
* @var string email reply to
|
||||
*/
|
||||
@ -175,6 +180,16 @@ class Mailing extends CommonObject
|
||||
*/
|
||||
public $statuts = array();
|
||||
|
||||
/**
|
||||
* @var array substitutionarray
|
||||
*/
|
||||
public $substitutionarray;
|
||||
|
||||
/**
|
||||
* @var array substitutionarrayfortest
|
||||
*/
|
||||
public $substitutionarrayfortest;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -901,7 +901,7 @@ if (empty($reshook)) {
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
if ($prod_entry_mode == 'free') {
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? price2num(GETPOST('tva_tx')) : 0);
|
||||
$tva_tx = (GETPOST('tva_tx') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx'))) : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$tva_tx = '';
|
||||
@ -1644,7 +1644,7 @@ if ($action == 'create') {
|
||||
|
||||
// Ref customer
|
||||
print '<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans('RefCustomer').'</td><td class="valuefieldcreate">';
|
||||
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
|
||||
print '<input type="text" name="ref_client" value="'.(!empty($ref_client)?$ref_client:GETPOST('ref_client')).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Third party
|
||||
|
||||
@ -135,8 +135,13 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
// Add external contacts ids.
|
||||
$this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
|
||||
$tmparray = $this->propal->liste_contact(-1, 'external', $contact_list);
|
||||
if (is_array($tmparray)) {
|
||||
$this->propal->contacts_ids = $tmparray;
|
||||
}
|
||||
|
||||
$this->propal->fetchObjectLinked();
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
@ -228,7 +233,10 @@ class Proposals extends DolibarrApi
|
||||
$proposal_static = new Propal($this->db);
|
||||
if ($proposal_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
|
||||
$tmparray = $proposal_static->liste_contact(-1, 'external', 1);
|
||||
if (is_array($tmparray)) {
|
||||
$proposal_static->contacts_ids = $tmparray;
|
||||
}
|
||||
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
|
||||
}
|
||||
$i++;
|
||||
@ -343,8 +351,8 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data->desc = checkVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = checkVal($request_data->label);
|
||||
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = sanitizeVal($request_data->label);
|
||||
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
@ -488,8 +496,8 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data->desc = checkVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = checkVal($request_data->label);
|
||||
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = sanitizeVal($request_data->label);
|
||||
|
||||
$propalline = new PropaleLigne($this->db);
|
||||
$result = $propalline->fetch($lineid);
|
||||
@ -645,7 +653,7 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$contacts = $this->invoice->liste_contact();
|
||||
$contacts = $this->propal->liste_contact();
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
|
||||
@ -296,8 +296,8 @@ class Propal extends CommonObject
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
@ -317,7 +317,7 @@ class Propal extends CommonObject
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
|
||||
@ -327,7 +327,7 @@ class Propal extends CommonObject
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
@ -490,7 +490,6 @@ class Propal extends CommonObject
|
||||
$line->subprice = -$remise->amount_ht;
|
||||
$line->fk_product = 0; // Id produit predefined
|
||||
$line->qty = 1;
|
||||
$line->remise = 0;
|
||||
$line->remise_percent = 0;
|
||||
$line->rang = -1;
|
||||
$line->info_bits = 2;
|
||||
@ -736,7 +735,6 @@ class Propal extends CommonObject
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
@ -936,7 +934,6 @@ class Propal extends CommonObject
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
@ -1520,6 +1517,7 @@ class Propal extends CommonObject
|
||||
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
||||
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
|
||||
$sql .= ", p.datec";
|
||||
$sql .= ", p.date_signature as dates";
|
||||
$sql .= ", p.date_valid as datev";
|
||||
$sql .= ", p.datep as dp";
|
||||
$sql .= ", p.fin_validite as dfv";
|
||||
@ -1603,6 +1601,7 @@ class Propal extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
|
||||
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
|
||||
$this->date_signature = $this->db->jdate($obj->dates); // Signature date
|
||||
$this->date = $this->db->jdate($obj->dp); // Proposal date
|
||||
$this->datep = $this->db->jdate($obj->dp); // deprecated
|
||||
$this->fin_validite = $this->db->jdate($obj->dfv);
|
||||
@ -1900,14 +1899,15 @@ class Propal extends CommonObject
|
||||
|
||||
// multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($objp->fk_product);
|
||||
$tmpproduct->getMultiLangs();
|
||||
|
||||
$line->multilangs = $tmpproduct->multilangs;
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
//dol_syslog("1 ".$line->fk_product);
|
||||
//print "xx $i ".$this->lines[$i]->fk_product;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -3993,6 +3993,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
|
||||
|
||||
/**
|
||||
* Class line Contructor
|
||||
*
|
||||
@ -4132,9 +4133,6 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->rang)) {
|
||||
$this->rang = 0;
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0;
|
||||
}
|
||||
if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
@ -4364,9 +4362,6 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->price)) {
|
||||
$this->price = 0; // TODO A virer
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0; // TODO A virer
|
||||
}
|
||||
if (empty($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ $arrayfields = array(
|
||||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1),
|
||||
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
|
||||
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
|
||||
@ -377,14 +377,14 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||
if ($tmpproposal->valid($user) > 0) {
|
||||
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
||||
setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), 'errors');
|
||||
setEventMessages($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -410,7 +410,7 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||
setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
@ -765,12 +765,12 @@ if ($resql) {
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfProposals').' - '.$soc->name;
|
||||
$title = $langs->trans('Proposals').' - '.$soc->name;
|
||||
if (empty($search_societe)) {
|
||||
$search_societe = $soc->name;
|
||||
}
|
||||
} else {
|
||||
$title = $langs->trans('ListOfProposals');
|
||||
$title = $langs->trans('Proposals');
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@ -1697,8 +1697,8 @@ if ($action == 'create' && $usercancreate) {
|
||||
if ($socid > 0) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
print img_picto('', 'contact');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1);
|
||||
print img_picto('', 'contact', 'class="pictofixedwidth"');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
@ -1733,10 +1733,10 @@ if ($action == 'create' && $usercancreate) {
|
||||
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Terms of the settlement
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment', 'class="pictofixedwidth"');
|
||||
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent);
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
@ -1755,7 +1755,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Shipping Method
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"');
|
||||
print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1836,7 +1836,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -2735,7 +2735,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
|
||||
// Create intervention
|
||||
if ($conf->ficheinter->enabled) {
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$langs->load("interventions");
|
||||
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||
|
||||
@ -133,7 +133,10 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
|
||||
// Add external contacts ids
|
||||
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
||||
$tmparray = $this->commande->liste_contact(-1, 'external', $contact_list);
|
||||
if (is_array($tmparray)) {
|
||||
$this->commande->contacts_ids = $tmparray;
|
||||
}
|
||||
$this->commande->fetchObjectLinked();
|
||||
|
||||
// Add online_payment_url, cf #20477
|
||||
@ -234,7 +237,10 @@ class Orders extends DolibarrApi
|
||||
$commande_static = new Commande($this->db);
|
||||
if ($commande_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
||||
$tmparray = $commande_static->liste_contact(-1, 'external', 1);
|
||||
if (is_array($tmparray)) {
|
||||
$commande_static->contacts_ids = $tmparray;
|
||||
}
|
||||
// Add online_payment_url, cf #20477
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
|
||||
@ -344,8 +350,8 @@ class Orders extends DolibarrApi
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data->desc = checkVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = checkVal($request_data->label);
|
||||
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = sanitizeVal($request_data->label);
|
||||
|
||||
$updateRes = $this->commande->addline(
|
||||
$request_data->desc,
|
||||
@ -412,8 +418,8 @@ class Orders extends DolibarrApi
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data->desc = checkVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = checkVal($request_data->label);
|
||||
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = sanitizeVal($request_data->label);
|
||||
|
||||
$updateRes = $this->commande->updateline(
|
||||
$lineid,
|
||||
|
||||
@ -313,8 +313,8 @@ class Commande extends CommonOrder
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
@ -334,14 +334,14 @@ class Commande extends CommonOrder
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
@ -359,7 +359,7 @@ class Commande extends CommonOrder
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>304),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
@ -1666,7 +1666,6 @@ class Commande extends CommonOrder
|
||||
|
||||
// TODO Ne plus utiliser
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
$this->line->array_options = $array_options;
|
||||
@ -2010,7 +2009,6 @@ class Commande extends CommonOrder
|
||||
$line->price = -$remise->amount_ht;
|
||||
$line->fk_product = 0; // Id produit predefini
|
||||
$line->qty = 1;
|
||||
$line->remise = 0;
|
||||
$line->remise_percent = 0;
|
||||
$line->rang = -1;
|
||||
$line->info_bits = 2;
|
||||
@ -2154,9 +2152,11 @@ class Commande extends CommonOrder
|
||||
|
||||
// multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($objp->fk_product);
|
||||
$tmpproduct->getMultiLangs();
|
||||
|
||||
$line->multilangs = $tmpproduct->multilangs;
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
@ -3262,7 +3262,6 @@ class Commande extends CommonOrder
|
||||
|
||||
// TODO deprecated
|
||||
$this->line->price = $price;
|
||||
$this->line->remise = $remise;
|
||||
|
||||
if (is_array($array_options) && count($array_options) > 0) {
|
||||
// We replace values in this->line->array_options only for entries defined into $array_options
|
||||
@ -4404,9 +4403,6 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->rang)) {
|
||||
$this->rang = 0;
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0;
|
||||
}
|
||||
if (empty($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
@ -4447,7 +4443,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
|
||||
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
|
||||
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
|
||||
$sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
|
||||
$sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,';
|
||||
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
|
||||
$sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,';
|
||||
$sql .= ' fk_unit';
|
||||
@ -4470,7 +4466,6 @@ class OrderLine extends CommonOrderLine
|
||||
$sql .= " '".price2num($this->remise_percent)."',";
|
||||
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";
|
||||
$sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").",";
|
||||
$sql .= " '".price2num($this->remise)."',";
|
||||
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
|
||||
$sql .= ' '.((int) $this->special_code).',';
|
||||
$sql .= ' '.((int) $this->rang).',';
|
||||
@ -4579,9 +4574,6 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->marge_tx)) {
|
||||
$this->marge_tx = 0;
|
||||
}
|
||||
if (empty($this->remise)) {
|
||||
$this->remise = 0;
|
||||
}
|
||||
if (empty($this->remise_percent)) {
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ $arrayfields = array(
|
||||
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
|
||||
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
|
||||
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
|
||||
@ -1015,12 +1015,12 @@ if ($resql) {
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfOrders').' - '.$soc->name;
|
||||
$title = $langs->trans('CustomersOrders').' - '.$soc->name;
|
||||
if (empty($search_company)) {
|
||||
$search_company = $soc->name;
|
||||
}
|
||||
} else {
|
||||
$title = $langs->trans('ListOfOrders');
|
||||
$title = $langs->trans('CustomersOrders');
|
||||
}
|
||||
if (strval($search_status) == '0') {
|
||||
$title .= ' - '.$langs->trans('StatusOrderDraftShort');
|
||||
|
||||
@ -32,14 +32,15 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
|
||||
@ -54,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("banks", "bills", "categories", "companies", "margins", "salaries", "loan", "donations", "trips", "members", "compta", "accountancy"));
|
||||
@ -99,6 +101,7 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search
|
||||
$search_req_nb = GETPOST("req_nb", 'alpha');
|
||||
$search_num_releve = GETPOST("search_num_releve", 'alpha');
|
||||
$search_conciliated = GETPOST("search_conciliated", 'int');
|
||||
$search_fk_bordereau = GETPOST("search_fk_bordereau", 'int');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$num_releve = GETPOST("num_releve", "alpha");
|
||||
@ -157,20 +160,21 @@ $extrafields->fetch_name_optionals_label('banktransaction');
|
||||
$search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
|
||||
|
||||
$arrayfields = array(
|
||||
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
|
||||
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
|
||||
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
|
||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
|
||||
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500),
|
||||
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
|
||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
||||
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
||||
'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
||||
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1,'position'=>10),
|
||||
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1,'position'=>20),
|
||||
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1,'position'=>30),
|
||||
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1,'position'=>40),
|
||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1,'position'=>50),
|
||||
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1,'position'=>60),
|
||||
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>70),
|
||||
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>80),
|
||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>90),
|
||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>100),
|
||||
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>110),
|
||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120),
|
||||
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130),
|
||||
'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140),
|
||||
'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeReceipt"), 'checked'=>0, 'position'=>150),
|
||||
);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
@ -178,7 +182,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -214,6 +217,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_thirdparty_user = '';
|
||||
$search_num_releve = '';
|
||||
$search_conciliated = '';
|
||||
$search_fk_bordereau = '';
|
||||
$toselect = array();
|
||||
|
||||
$search_account = "";
|
||||
@ -390,8 +394,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->ba
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -421,6 +423,7 @@ $paymentvariousstatic = new PaymentVarious($db);
|
||||
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
||||
$bankstatic = new Account($db);
|
||||
$banklinestatic = new AccountLine($db);
|
||||
$bordereaustatic = new RemiseCheque($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -465,6 +468,9 @@ if (!empty($search_num_releve)) {
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||
}
|
||||
if ($search_fk_bordereau > 0) {
|
||||
$param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau);
|
||||
}
|
||||
if ($search_bid > 0) {
|
||||
$param .= '&search_bid='.urlencode($search_bid);
|
||||
}
|
||||
@ -568,8 +574,9 @@ if ($id > 0 || !empty($ref)) {
|
||||
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
|
||||
$sql .= " b.fk_account, b.fk_type,";
|
||||
$sql .= " b.fk_account, b.fk_type, b.fk_bordereau,";
|
||||
$sql .= " ba.rowid as bankid, ba.ref as bankref";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
@ -621,6 +628,9 @@ if ($search_num_releve) {
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||
$sql .= " AND b.rappro = ".((int) $search_conciliated);
|
||||
}
|
||||
if ($search_fk_bordereau > 0) {
|
||||
$sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
|
||||
}
|
||||
if ($search_thirdparty_user) {
|
||||
$sql.= " AND (b.rowid IN ";
|
||||
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
|
||||
@ -737,6 +747,9 @@ if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||
if (!empty($search_num_releve)) {
|
||||
$mode_balance_ok = false;
|
||||
}
|
||||
if (!empty($search_fk_bordereau)) {
|
||||
$mode_balance_ok = false;
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
@ -1067,34 +1080,40 @@ if ($resql) {
|
||||
$form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Numero
|
||||
if (!empty($arrayfields['b.num_chq']['checked'])) {
|
||||
// Numero
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||
}
|
||||
// Checked
|
||||
if (!empty($arrayfields['bu.label']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).'"></td>';
|
||||
}
|
||||
// Ref
|
||||
if (!empty($arrayfields['ba.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''), 0, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Debit
|
||||
if (!empty($arrayfields['b.debit']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Credit
|
||||
if (!empty($arrayfields['b.credit']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Balance before
|
||||
if (!empty($arrayfields['balancebefore']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
$htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||
print $form->textwithpicto('', $htmltext, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Balance
|
||||
if (!empty($arrayfields['balance']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
$htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||
@ -1111,6 +1130,11 @@ if ($resql) {
|
||||
print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Bordereau
|
||||
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).'" size="3"></td>';
|
||||
}
|
||||
|
||||
// Actions and select
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
@ -1162,6 +1186,10 @@ if ($resql) {
|
||||
if (!empty($arrayfields['b.conciliated']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
}
|
||||
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -1673,6 +1701,16 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
|
||||
$bordereaustatic->fetch($objp->fk_bordereau);
|
||||
print '<td class="nowraponall" align="center">';
|
||||
print $bordereaustatic->getNomUrl();
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Action edit/delete and select
|
||||
print '<td class="nowraponall" align="center">';
|
||||
// Transaction reconciliated or edit link
|
||||
|
||||
@ -250,7 +250,7 @@ class BankAccounts extends DolibarrApi
|
||||
}
|
||||
|
||||
// Clean data
|
||||
$description = checkVal($description, 'alphanohtml');
|
||||
$description = sanitizeVal($description, 'alphanohtml');
|
||||
|
||||
|
||||
/**
|
||||
@ -498,13 +498,13 @@ class BankAccounts extends DolibarrApi
|
||||
throw new RestException(404, 'account not found');
|
||||
}
|
||||
|
||||
$type = checkVal($type);
|
||||
$label = checkVal($label);
|
||||
$cheque_number = checkVal($cheque_number);
|
||||
$cheque_writer = checkVal($cheque_writer);
|
||||
$cheque_bank = checkVal($cheque_bank);
|
||||
$accountancycode = checkVal($accountancycode);
|
||||
$num_releve = checkVal($num_releve);
|
||||
$type = sanitizeVal($type);
|
||||
$label = sanitizeVal($label);
|
||||
$cheque_number = sanitizeVal($cheque_number);
|
||||
$cheque_writer = sanitizeVal($cheque_writer);
|
||||
$cheque_bank = sanitizeVal($cheque_bank);
|
||||
$accountancycode = sanitizeVal($accountancycode);
|
||||
$num_releve = sanitizeVal($num_releve);
|
||||
|
||||
$result = $account->addline(
|
||||
$date,
|
||||
@ -557,9 +557,9 @@ class BankAccounts extends DolibarrApi
|
||||
throw new RestException(404, 'account line not found');
|
||||
}
|
||||
|
||||
$url = checkVal($url);
|
||||
$label = checkVal($label);
|
||||
$type = checkVal($type);
|
||||
$url = sanitizeVal($url);
|
||||
$label = sanitizeVal($label);
|
||||
$type = sanitizeVal($type);
|
||||
|
||||
$result = $account->add_url_line($line_id, $url_id, $url, $label, $type);
|
||||
if ($result < 0) {
|
||||
|
||||
@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->element = 'payment_various';
|
||||
|
||||
@ -127,7 +127,7 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
$acline = new AccountLine($db);
|
||||
$result = $acline->fetch($rowid);
|
||||
if ($result <= 0) {
|
||||
dol_syslog('Failed to read bank line with id '.$rowid, LOG_ERR); // This happens due to old bug that has set fk_account to null.
|
||||
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.
|
||||
$acline->id = $rowid;
|
||||
}
|
||||
|
||||
@ -334,11 +334,12 @@ if ($result) {
|
||||
// Bank account
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
|
||||
print '<td>';
|
||||
if (!$objp->rappro && !$bankline->getVentilExportCompta()) {
|
||||
// $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it.
|
||||
if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) {
|
||||
print $acct->getNomUrl(1, 'transactions', 'reflabel');
|
||||
} else {
|
||||
print img_picto('', 'bank_account', 'class="paddingright"');
|
||||
print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1);
|
||||
} else {
|
||||
print $acct->getNomUrl(1, 'transactions', 'reflabel');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -534,7 +534,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['b.ref']['checked'])) {
|
||||
print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$objecttmp->getNomUrl(1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -586,7 +586,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Accountancy journal
|
||||
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax125">';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if (empty($objecttmp->fk_accountancy_journal)) {
|
||||
print img_warning($langs->trans("Mandatory"));
|
||||
@ -606,7 +606,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['b.currency_code']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print $objecttmp->currency_code;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -616,7 +616,7 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Transactions to reconcile
|
||||
if (!empty($arrayfields['toreconcile']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center tdoverflowmax125">';
|
||||
|
||||
$conciliate = $objecttmp->canBeConciliated();
|
||||
if ($conciliate == -2) {
|
||||
@ -663,7 +663,7 @@ foreach ($accounts as $key => $type) {
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['b.datec']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($objecttmp->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -672,7 +672,7 @@ foreach ($accounts as $key => $type) {
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['b.tms']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($objecttmp->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
||||
@ -539,7 +539,7 @@ if ($resql) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -656,7 +656,7 @@ if ($resql) {
|
||||
if ($arrayfields['account']['checked']) {
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$obj->accountancy_label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -664,7 +664,7 @@ if ($resql) {
|
||||
|
||||
// Accounting subledger account
|
||||
if ($arrayfields['subledger']['checked']) {
|
||||
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -647,7 +647,7 @@ if (empty($action) || $action == "view" || $action == "close") {
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright">>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
@ -659,11 +659,11 @@ if (empty($action) || $action == "view" || $action == "close") {
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="middle">'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td><td>';
|
||||
print price($object->opening, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print '<span class="amount">'.price($object->opening, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
print "</td></tr>";
|
||||
foreach ($arrayofpaymentmode as $key => $val) {
|
||||
print '<tr><td valign="middle">'.$langs->trans($val).'</td><td>';
|
||||
print price($object->$key, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
print '<span class="amount">'.price($object->$key, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
|
||||
$sql = "SELECT c.id, c.libelle as label,";
|
||||
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
||||
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
|
||||
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
|
||||
$sql .= " pct.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."c_chargesociales as c,";
|
||||
@ -185,7 +185,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
$i = 0;
|
||||
$total = 0;
|
||||
$totalnb = 0;
|
||||
$totalpaye = 0;
|
||||
$totalpaid = 0;
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -239,15 +239,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
}
|
||||
// Paid
|
||||
print '<td class="right">';
|
||||
if ($obj->totalpaye) {
|
||||
print price($obj->totalpaye);
|
||||
if ($obj->totalpaid) {
|
||||
print price($obj->totalpaid);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total = $total + $obj->total;
|
||||
$totalnb = $totalnb + $obj->nb;
|
||||
$totalpaye = $totalpaye + $obj->totalpaye;
|
||||
$totalpaid = $totalpaid + $obj->totalpaid;
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
@ -258,7 +258,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price($totalpaye)."</td>";
|
||||
print '<td class="liste_total right">'.price($totalpaid)."</td>";
|
||||
print "</tr>";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
||||
@ -121,7 +121,7 @@ class Deplacement extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ if ($resql) {
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
}
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
|
||||
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
|
||||
|
||||
@ -1695,7 +1695,20 @@ if ($action == 'create') {
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
//$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
|
||||
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
|
||||
|
||||
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
|
||||
$usercancreatemargin = $user->rights->margins->creer;
|
||||
$usercanreadallmargin = $user->rights->margins->liretous;
|
||||
$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
|
||||
$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
|
||||
$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
|
||||
$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
@ -305,7 +305,7 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $object->willBeLastOfSameType();
|
||||
$last_of_type = $object->willBeLastOfSameType(true);
|
||||
if (empty($object->date_validation) && !$last_of_type[0]) {
|
||||
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
|
||||
$action = '';
|
||||
@ -725,14 +725,14 @@ if (empty($reshook)) {
|
||||
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$totalpaye += $objp->amount;
|
||||
$totalpaid += $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, '');
|
||||
}
|
||||
|
||||
$resteapayer = $object->total_ttc - $totalpaye;
|
||||
$resteapayer = $object->total_ttc - $totalpaid;
|
||||
|
||||
// We check that invlice lines are transferred into accountancy
|
||||
$ventilExportCompta = $object->getVentilExportCompta();
|
||||
@ -1255,10 +1255,10 @@ if (empty($reshook)) {
|
||||
|
||||
if (GETPOST('invoiceAvoirWithPaymentRestAmount', 'int') == 1 && $id > 0) {
|
||||
if ($facture_source->fetch($object->fk_facture_source) > 0) {
|
||||
$totalpaye = $facture_source->getSommePaiement();
|
||||
$totalpaid = $facture_source->getSommePaiement();
|
||||
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
|
||||
$totaldeposits = $facture_source->getSumDepositsUsed();
|
||||
$remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits);
|
||||
$remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
|
||||
|
||||
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 1, 0, 0, 0, 0, 0, '', '', 'TTC');
|
||||
}
|
||||
@ -3899,24 +3899,24 @@ if ($action == 'create') {
|
||||
}
|
||||
$selleruserevenustamp = $mysoc->useRevenueStamp();
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
$totalpaid = $object->getSommePaiement();
|
||||
$totalcreditnotes = $object->getSumCreditNotesUsed();
|
||||
$totaldeposits = $object->getSumDepositsUsed();
|
||||
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
|
||||
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
|
||||
// selleruserrevenuestamp=".$selleruserevenustamp;
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
// $resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$multicurrency_totalpaye = $object->getSommePaiement(1);
|
||||
$multicurrency_totalpaid = $object->getSommePaiement(1);
|
||||
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
|
||||
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
|
||||
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
|
||||
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaid - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
|
||||
// Code to fix case of corrupted data
|
||||
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
|
||||
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
|
||||
@ -4317,7 +4317,7 @@ if ($action == 'create') {
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
@ -4926,7 +4926,7 @@ if ($action == 'create') {
|
||||
$total_next_ht = $total_next_ttc = 0;
|
||||
|
||||
foreach ($object->tab_next_situation_invoice as $next_invoice) {
|
||||
$totalpaye = $next_invoice->getSommePaiement();
|
||||
$totalpaid = $next_invoice->getSommePaiement();
|
||||
$total_next_ht += $next_invoice->total_ht;
|
||||
$total_next_ttc += $next_invoice->total_ttc;
|
||||
|
||||
@ -4939,7 +4939,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -5072,7 +5072,7 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print $langs->trans('AlreadyPaid');
|
||||
}
|
||||
print '</span></td><td class="right'.(($totalpaye > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaye).'</td><td> </td></tr>';
|
||||
print '</span></td><td class="right'.(($totalpaid > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaid).'</td><td> </td></tr>';
|
||||
|
||||
$resteapayeraffiche = $resteapayer;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
@ -5125,7 +5125,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5135,7 +5135,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td> </td></tr>';
|
||||
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</td><td> </td></tr>';
|
||||
// $resteapayeraffiche=0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5145,7 +5145,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5159,7 +5159,7 @@ if ($action == 'create') {
|
||||
print '<span class="opacitymedium">';
|
||||
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
$resteapayeraffiche = 0;
|
||||
$cssforamountpaymentcomplete = 'amountpaymentneutral';
|
||||
}
|
||||
@ -5220,7 +5220,7 @@ if ($action == 'create') {
|
||||
// Total already paid back
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right">';
|
||||
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td> </td></tr>';
|
||||
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaid).'</span></td><td> </td></tr>';
|
||||
|
||||
// Billed
|
||||
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td> </td></tr>';
|
||||
@ -5498,8 +5498,8 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
$sumofpayment = $totalpaye;
|
||||
$sumofpaymentall = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||
$sumofpayment = $totalpaid;
|
||||
$sumofpaymentall = $totalpaid + $totalcreditnotes + $totaldeposits;
|
||||
|
||||
// Reverse back money or convert to reduction
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
|
||||
@ -5551,7 +5551,7 @@ if ($action == 'create') {
|
||||
|
||||
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
|
||||
if ($totalpaye > 0 || $totalcreditnotes > 0) {
|
||||
if ($totalpaid > 0 || $totalcreditnotes > 0) {
|
||||
// If one payment or one credit note was linked to this invoice
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
|
||||
} else {
|
||||
@ -5575,7 +5575,7 @@ if ($action == 'create') {
|
||||
// For situation invoice with excess received
|
||||
if ($object->statut > Facture::STATUS_DRAFT
|
||||
&& $object->type == Facture::TYPE_SITUATION
|
||||
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& ($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits) > 0
|
||||
&& $usercancreate
|
||||
&& !$objectidnext
|
||||
&& $object->is_last_in_cycle()
|
||||
|
||||
@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
|
||||
|
||||
// Add external contacts ids
|
||||
if ($contact_list > -1) {
|
||||
$this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
|
||||
$tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
|
||||
if (is_array($tmparray)) {
|
||||
$this->invoice->contacts_ids = $tmparray;
|
||||
}
|
||||
}
|
||||
|
||||
$this->invoice->fetchObjectLinked();
|
||||
@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
|
||||
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
|
||||
|
||||
// Add external contacts ids
|
||||
$invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
|
||||
|
||||
$tmparray = $invoice_static->liste_contact(-1, 'external', 1);
|
||||
if (is_array($tmparray)) {
|
||||
$invoice_static->contacts_ids = $tmparray;
|
||||
}
|
||||
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
|
||||
}
|
||||
$i++;
|
||||
@ -423,8 +428,8 @@ class Invoices extends DolibarrApi
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data->desc = checkVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = checkVal($request_data->label);
|
||||
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = sanitizeVal($request_data->label);
|
||||
|
||||
$updateRes = $this->invoice->updateline(
|
||||
$lineid,
|
||||
@ -713,8 +718,8 @@ class Invoices extends DolibarrApi
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$request_data->desc = checkVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = checkVal($request_data->label);
|
||||
$request_data->desc = sanitizeVal($request_data->desc, 'restricthtml');
|
||||
$request_data->label = sanitizeVal($request_data->label);
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) {
|
||||
@ -1420,10 +1425,10 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
|
||||
// Calculate amount to pay
|
||||
$totalpaye = $this->invoice->getSommePaiement();
|
||||
$totalpaid = $this->invoice->getSommePaiement();
|
||||
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
|
||||
$totaldeposits = $this->invoice->getSumDepositsUsed();
|
||||
$resteapayer = price2num($this->invoice->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
$resteapayer = price2num($this->invoice->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -1562,10 +1567,10 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
|
||||
// Calculate amount to pay
|
||||
$totalpaye = $this->invoice->getSommePaiement($is_multicurrency);
|
||||
$totalpaid = $this->invoice->getSommePaiement($is_multicurrency);
|
||||
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed($is_multicurrency);
|
||||
$totaldeposits = $this->invoice->getSumDepositsUsed($is_multicurrency);
|
||||
$remainstopay = $amount = price2num($total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
$remainstopay = $amount = price2num($total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
if (!$is_multicurrency && $amountarray["amount"] != 'remain') {
|
||||
$amount = price2num($amountarray["amount"], 'MT');
|
||||
@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi
|
||||
|
||||
// Add external contacts ids
|
||||
if ($contact_list > -1) {
|
||||
$this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
|
||||
$tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
|
||||
if (is_array($tmparray)) {
|
||||
$this->template_invoice->contacts_ids = $tmparray;
|
||||
}
|
||||
}
|
||||
|
||||
$this->template_invoice->fetchObjectLinked();
|
||||
|
||||
@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice
|
||||
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
|
||||
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
|
||||
@ -222,7 +222,7 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
@ -270,6 +270,7 @@ class FactureRec extends CommonInvoice
|
||||
if ($result > 0) {
|
||||
// On positionne en mode brouillon la facture
|
||||
$this->brouillon = 1;
|
||||
$this->fk_soc = $facsrc->socid;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (";
|
||||
$sql .= "titre";
|
||||
@ -301,7 +302,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql .= ", suspended";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
|
||||
$sql .= ", ".((int) $facsrc->socid);
|
||||
$sql .= ", ".((int) $this->fk_soc);
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", ".(!empty($facsrc->total_ttc) ? ((float) $facsrc->total_ttc) : '0');
|
||||
@ -1256,9 +1257,10 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @param int $restrictioninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
|
||||
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0)
|
||||
public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs, $db, $user, $hookmanager;
|
||||
|
||||
@ -1331,6 +1333,11 @@ class FactureRec extends CommonInvoice
|
||||
$facture->status = self::STATUS_DRAFT;
|
||||
$facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||
$facture->socid = $facturerec->socid;
|
||||
if (!empty($facturerec->fk_multicurrency)) {
|
||||
$facture->fk_multicurrency = $facturerec->fk_multicurrency;
|
||||
$facture->multicurrency_code = $facturerec->multicurrency_code;
|
||||
$facture->multicurrency_tx = $facturerec->multicurrency_tx;
|
||||
}
|
||||
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0) {
|
||||
@ -1338,6 +1345,8 @@ class FactureRec extends CommonInvoice
|
||||
$this->error = $facture->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (!$error && ($facturerec->auto_validate || $forcevalidation)) {
|
||||
$result = $facture->validate($user);
|
||||
if ($result <= 0) {
|
||||
@ -1356,6 +1365,16 @@ class FactureRec extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $facturerec->call_trigger('BILLREC_CREATEBILL', $user);
|
||||
if ($result < 0) {
|
||||
$this->errors = $facturerec->errors;
|
||||
$this->error = $facturerec->error;
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n";
|
||||
@ -1788,10 +1807,13 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @param int $frequency value of frequency
|
||||
* @param string $unit unit of frequency (d, m, y)
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setFrequencyAndUnit($frequency, $unit)
|
||||
public function setFrequencyAndUnit($frequency, $unit, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (!$this->table_element) {
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
@ -1815,6 +1837,16 @@ class FactureRec extends CommonInvoice
|
||||
if (!empty($unit)) {
|
||||
$this->unit_frequency = $unit;
|
||||
}
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@ -1827,10 +1859,14 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @param datetime $date date of execution
|
||||
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setNextDate($date, $increment_nb_gen_done = 0)
|
||||
public function setNextDate($date, $increment_nb_gen_done = 0, $notrigger = 0)
|
||||
{
|
||||
|
||||
global $user;
|
||||
|
||||
if (!$this->table_element) {
|
||||
dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
@ -1848,6 +1884,15 @@ class FactureRec extends CommonInvoice
|
||||
if ($increment_nb_gen_done > 0) {
|
||||
$this->nb_gen_done++;
|
||||
}
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@ -1859,10 +1904,14 @@ class FactureRec extends CommonInvoice
|
||||
* Update the maximum period
|
||||
*
|
||||
* @param int $nb number of maximum period
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setMaxPeriod($nb)
|
||||
public function setMaxPeriod($nb, $notrigger = 0)
|
||||
{
|
||||
|
||||
global $user;
|
||||
|
||||
if (!$this->table_element) {
|
||||
dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
@ -1879,6 +1928,16 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setMaxPeriod", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->nb_gen_max = $nb;
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@ -1890,10 +1949,13 @@ class FactureRec extends CommonInvoice
|
||||
* Update the auto validate flag of invoice
|
||||
*
|
||||
* @param int $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setAutoValidate($validate)
|
||||
public function setAutoValidate($validate, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (!$this->table_element) {
|
||||
dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
@ -1906,6 +1968,16 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->auto_validate = $validate;
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@ -1917,10 +1989,13 @@ class FactureRec extends CommonInvoice
|
||||
* Update the auto generate documents
|
||||
*
|
||||
* @param int $validate 0 no document, 1 to generate document
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setGeneratePdf($validate)
|
||||
public function setGeneratePdf($validate, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
if (!$this->table_element) {
|
||||
dol_syslog(get_class($this)."::setGeneratePdf was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
@ -1933,6 +2008,16 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setGeneratePdf", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->generate_pdf = $validate;
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@ -1944,10 +2029,12 @@ class FactureRec extends CommonInvoice
|
||||
* Update the model for documents
|
||||
*
|
||||
* @param string $model model of document generator
|
||||
* @param int $notrigger Disable the trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setModelPdf($model)
|
||||
public function setModelPdf($model, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
if (!$this->table_element) {
|
||||
dol_syslog(get_class($this)."::setModelPdf was called on objet with property table_element not defined", LOG_ERR);
|
||||
return -1;
|
||||
@ -1960,6 +2047,16 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$this->model_pdf = $model;
|
||||
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return $result;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
|
||||
@ -428,7 +428,7 @@ class Facture extends CommonInvoice
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
@ -560,7 +560,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
$this->array_options = $_facrec->array_options;
|
||||
|
||||
//if (! $this->remise) $this->remise = 0;
|
||||
if (!$this->mode_reglement_id) {
|
||||
$this->mode_reglement_id = 0;
|
||||
}
|
||||
@ -1652,13 +1651,13 @@ class Facture extends CommonInvoice
|
||||
0, // date_start
|
||||
0, // date_end
|
||||
0,
|
||||
$lines[$i]->info_bits, // info_bits
|
||||
0, // info_bits
|
||||
0,
|
||||
'HT',
|
||||
0,
|
||||
0, // product_type
|
||||
1,
|
||||
$lines[$i]->special_code,
|
||||
0, // special_code
|
||||
$deposit->origin,
|
||||
0,
|
||||
0,
|
||||
@ -2194,9 +2193,11 @@ class Facture extends CommonInvoice
|
||||
|
||||
// multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
||||
$line = new Product($this->db);
|
||||
$line->fetch($objp->fk_product);
|
||||
$line->getMultiLangs();
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($objp->fk_product);
|
||||
$tmpproduct->getMultiLangs();
|
||||
|
||||
$line->multilangs = $tmpproduct->multilangs;
|
||||
}
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
@ -3009,7 +3010,7 @@ class Facture extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $this->willBeLastOfSameType();
|
||||
$last_of_type = $this->willBeLastOfSameType(true);
|
||||
if (!$last_of_type[0]) {
|
||||
$this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref, dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day'));
|
||||
return -1;
|
||||
@ -5025,7 +5026,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice', 0).")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($resql->num_rows > 0) {
|
||||
if ($this->db->num_rows($resql) > 0) {
|
||||
$res = $this->db->fetch_array($resql);
|
||||
$ref = $res['max(situation_cycle_ref)'];
|
||||
$ref++;
|
||||
@ -5070,7 +5071,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
$res = array();
|
||||
if ($resql && $resql->num_rows > 0) {
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
while ($row = $this->db->fetch_object($resql)) {
|
||||
$id = $row->rowid;
|
||||
$situation = new Facture($this->db);
|
||||
@ -5148,7 +5149,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql && $resql->num_rows > 0) {
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
$res = $this->db->fetch_array($resql);
|
||||
$last = $res['max(situation_counter)'];
|
||||
return ($last == $this->situation_counter);
|
||||
@ -5214,13 +5215,13 @@ class Facture extends CommonInvoice
|
||||
|
||||
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
|
||||
if ($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit)) {
|
||||
$totalpaye = $this->getSommePaiement();
|
||||
$totalpaye = floatval($totalpaye);
|
||||
$totalpaid = $this->getSommePaiement();
|
||||
$totalpaid = floatval($totalpaid);
|
||||
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
|
||||
if ($totalpaye >= 0 && $RetainedWarrantyAmount >= 0) {
|
||||
if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
|
||||
if ($totalpaid >= 0 && $RetainedWarrantyAmount >= 0) {
|
||||
if (($totalpaid < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
|
||||
$hasDelay = 1;
|
||||
} elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
|
||||
} elseif ($totalpaid < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
|
||||
$hasDelay = 1;
|
||||
} else {
|
||||
$hasDelay = 0;
|
||||
@ -5504,6 +5505,7 @@ class Facture extends CommonInvoice
|
||||
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
// Recipient
|
||||
$to = '';
|
||||
$res = $tmpinvoice->fetch_thirdparty();
|
||||
$recipient = $tmpinvoice->thirdparty;
|
||||
if ($res > 0) {
|
||||
@ -5525,7 +5527,7 @@ class Facture extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!$error && $to) {
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
|
||||
@ -5568,9 +5570,10 @@ class Facture extends CommonInvoice
|
||||
|
||||
/**
|
||||
* See if current invoice date is posterior to the last invoice date among validated invoices of same type.
|
||||
* @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state.
|
||||
* @return boolean
|
||||
*/
|
||||
public function willBeLastOfSameType()
|
||||
public function willBeLastOfSameType($allow_validated_drafts = false)
|
||||
{
|
||||
// get date of last validated invoices of same type
|
||||
$sql = "SELECT datef";
|
||||
@ -5587,7 +5590,12 @@ class Facture extends CommonInvoice
|
||||
$last_date = $this->db->jdate($obj->datef);
|
||||
$invoice_date = $this->date;
|
||||
|
||||
return [$invoice_date >= $last_date, $last_date];
|
||||
$is_last_of_same_type = $invoice_date >= $last_date;
|
||||
if ($allow_validated_drafts) {
|
||||
$is_last_of_same_type = $is_last_of_same_type || (!strpos($this->ref, 'PROV') && $this->status == self::STATUS_DRAFT);
|
||||
}
|
||||
|
||||
return [$is_last_of_same_type, $last_date];
|
||||
} else {
|
||||
// element is first of type to be validated
|
||||
return [true];
|
||||
@ -6281,7 +6289,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
|
||||
$sql = "SELECT situation_percent FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->fk_prev_id);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql && $resql->num_rows > 0) {
|
||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||
$res = $this->db->fetch_array($resql);
|
||||
|
||||
$returnPercent = floatval($res['situation_percent']);
|
||||
|
||||
@ -57,7 +57,7 @@ class FactureStats extends Stats
|
||||
* @param int $typentid Id typent of thirdpary for filter
|
||||
* @param int $categid Id category of thirdpary for filter
|
||||
*/
|
||||
public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
|
||||
public function __construct(DoliDB $db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ class PaymentTerm // extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ if ($user->socid) {
|
||||
$object = new Facture($db);
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'facture', $object->id);
|
||||
@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
$totalpaid = $object->getSommePaiement();
|
||||
|
||||
print dol_get_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), -1, 'bill');
|
||||
|
||||
@ -171,7 +171,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$head = facture_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
$totalpaid = $object->getSommePaiement();
|
||||
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -84,7 +84,7 @@ $object->info($object->id);
|
||||
$head = facture_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill');
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
$totalpaid = $object->getSommePaiement();
|
||||
|
||||
// Invoice content
|
||||
|
||||
@ -131,7 +131,7 @@ if (!empty($conf->projet->enabled)) {
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
@ -140,7 +140,7 @@ print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
print '<table class="centpercent"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
@ -857,7 +857,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['f.datec']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($db->jdate($objp->datec), 'dayhour');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
@ -865,7 +865,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['f.tms']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print '<td class="center nowraponall">';
|
||||
print dol_print_date($db->jdate($objp->tms), 'dayhour');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user