Merge branch 'develop' into translate-variable-name-and-add-hints
This commit is contained in:
commit
f758a8345e
@ -5,6 +5,7 @@
|
|||||||
# We use dist: xenial to have php 5.6+ available
|
# We use dist: xenial to have php 5.6+ available
|
||||||
os: linux
|
os: linux
|
||||||
dist: xenial
|
dist: xenial
|
||||||
|
#dist: bionic
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
|
|||||||
@ -326,6 +326,12 @@ source_file = htdocs/langs/en_US/receptions.lang
|
|||||||
source_lang = en_US
|
source_lang = en_US
|
||||||
type = MOZILLAPROPERTIES
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
|
[dolibarr.recruitment]
|
||||||
|
file_filter = htdocs/langs/<lang>/recruitment.lang
|
||||||
|
source_file = htdocs/langs/en_US/recruitment.lang
|
||||||
|
source_lang = en_US
|
||||||
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
[dolibarr.resource]
|
[dolibarr.resource]
|
||||||
file_filter = htdocs/langs/<lang>/resource.lang
|
file_filter = htdocs/langs/<lang>/resource.lang
|
||||||
source_file = htdocs/langs/en_US/resource.lang
|
source_file = htdocs/langs/en_US/resource.lang
|
||||||
|
|||||||
@ -39,7 +39,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes
|
|||||||
JS libraries:
|
JS libraries:
|
||||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
ChartJS 2.9.3 MIT License Yes JS library for graph
|
ChartJS 2.9.3 MIT License Yes JS library for graph
|
||||||
jQuery 3.4.1 MIT License Yes JS library
|
jQuery 3.5.1 MIT License Yes JS library
|
||||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.12.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
|
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
|
||||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||||
|
|||||||
64
ChangeLog
64
ChangeLog
@ -4,7 +4,7 @@ English Dolibarr ChangeLog
|
|||||||
|
|
||||||
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
|
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
|
||||||
For users:
|
For users:
|
||||||
|
NEW: Add module Credit transfer SEPA to manage payment of supplier using bank credit transfer SEPA files
|
||||||
|
|
||||||
|
|
||||||
WARNING:
|
WARNING:
|
||||||
@ -14,6 +14,68 @@ Following changes may create regressions for some external modules, but were nec
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
|
||||||
|
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
|
||||||
|
FIX: DebugBar hides content at page bottom
|
||||||
|
FIX: allow more harmless html tags
|
||||||
|
FIX: Bad back to link
|
||||||
|
FIX: Bad param
|
||||||
|
FIX: Can go on page even when module is disabled
|
||||||
|
FIX: Change position of line in BOM
|
||||||
|
FIX: Checkbox "drop table" was not checked when using php method to generate backup dump
|
||||||
|
FIX: ClickToDial tab of users has disappeared
|
||||||
|
FIX: CSS
|
||||||
|
FIX: date in supplier price log tooltip.
|
||||||
|
FIX: Debug module direct debit order. Solve conflict with credit transfer
|
||||||
|
FIX: Debug setup of receipt printer module
|
||||||
|
FIX: dolGetElementUrl and agenda page for external modules
|
||||||
|
FIX: DO not erase variable $key and $label during output of extrafields
|
||||||
|
FIX: duration fields size with firefox
|
||||||
|
FIX: Edit extrafield of type long text loose carriage returns
|
||||||
|
FIX: Fails to retraive accounting code of social contribution sometimes
|
||||||
|
FIX: Filter too large for extrafields with type text or html
|
||||||
|
FIX: If using a rounding step, localtax1+2 not included in total
|
||||||
|
FIX: input field of extrafields must keep data if form submit fails.
|
||||||
|
FIX: Label of opportunities in graph with special chars badly encoded
|
||||||
|
FIX: locataxes lost on lines when cloning a vendor invoice
|
||||||
|
FIX: Look and feel v12
|
||||||
|
FIX: Missing PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE conf support in supplier order
|
||||||
|
FIX: Navigation in object fails to find the next ref in some cases
|
||||||
|
FIX: null required
|
||||||
|
FIX: order by amount ht uses wrong column
|
||||||
|
FIX: Order by amount in product propal stats must be done on d.total_ht and not p.total
|
||||||
|
FIX: page for confirmation of payments is empty
|
||||||
|
FIX: Param of fetch_name_optionals_label must be object->table_element
|
||||||
|
FIX: Picto of HRM module
|
||||||
|
FIX: product label and desc were never updated when modifying translation
|
||||||
|
FIX: redirect on contact card from main search
|
||||||
|
FIX: Reposition and nav
|
||||||
|
FIX: search warehouse list
|
||||||
|
FIX: Setup of clicktodial hang on smartphone
|
||||||
|
FIX: Setup of currency limit and accuracy
|
||||||
|
FIX: shipping creation: checks not done on weight and sizes
|
||||||
|
FIX: Should not be able to edit qty on shipment when no stock available
|
||||||
|
FIX: Size of image on the help popup of modules
|
||||||
|
FIX: Sql error on stat by referring entries of a product
|
||||||
|
FIX: Warning if no bank account defined
|
||||||
|
FIX: We need to see unit line on PDF even though it's an option
|
||||||
|
FIX: wrong element var for fetch_name_optionals_label function with expeditions
|
||||||
|
FIX: wrong link to third invoice templates
|
||||||
|
FIX: Disable svg as supported image by default (can contains javascript). Set MAIN_ALLOW_SVG_FILES_AS_IMAGES to 1 to have svg accepted
|
||||||
|
FIX: #14076
|
||||||
|
FIX: #14146
|
||||||
|
FIX: #14209
|
||||||
|
FIX: #14222
|
||||||
|
FIX: #14236
|
||||||
|
FIX: #14241 Mysql 8 compatibility
|
||||||
|
FIX: #14253
|
||||||
|
FIX: #14256
|
||||||
|
FIX: #14259
|
||||||
|
FIX: #14279
|
||||||
|
FIX: #14291
|
||||||
|
FIX: #14292
|
||||||
|
FIX: #14336
|
||||||
|
|
||||||
***** ChangeLog for 12.0.1 compared to 12.0.0 *****
|
***** ChangeLog for 12.0.1 compared to 12.0.0 *****
|
||||||
FIX: reposition was broken if url end with #anchor
|
FIX: reposition was broken if url end with #anchor
|
||||||
FIX: $_POST must be GETPOST
|
FIX: $_POST must be GETPOST
|
||||||
|
|||||||
32
README.md
32
README.md
@ -3,13 +3,13 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||||
|
|
||||||
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelancers.
|
It's Open Source Software (written in PHP) designed for small, medium or large companies, foundations and freelancers.
|
||||||
|
|
||||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
You can freely use, study, modify or distribute it according to its licence.
|
||||||
|
|
||||||
You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN.
|
You can use it as a standalone application or as a web application to access it from the Internet or a LAN.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -35,11 +35,15 @@ Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
|||||||
|
|
||||||
### Advanced setup
|
### Advanced setup
|
||||||
|
|
||||||
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
You can use a web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
||||||
|
|
||||||
|
On GNU/Linux, first check if your distribution has already packaged Dolibarr.
|
||||||
|
|
||||||
|
#### Generic install steps:
|
||||||
|
|
||||||
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Versions).
|
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Versions).
|
||||||
|
|
||||||
- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git):
|
- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you know git as it makes it easier if you want to upgrade later):
|
||||||
|
|
||||||
`git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is main version like 3.6, 9.0, ...)
|
`git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is main version like 3.6, 9.0, ...)
|
||||||
|
|
||||||
@ -70,11 +74,11 @@ If you don't have time to install it yourself, you can try some commercial 'read
|
|||||||
|
|
||||||
## UPGRADING
|
## UPGRADING
|
||||||
|
|
||||||
- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr
|
- At first make a backup of your Dolibarr files & then read https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr
|
||||||
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
|
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
|
||||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||||
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
|
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
|
||||||
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||||
|
|
||||||
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
||||||
|
|
||||||
@ -139,7 +143,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
|||||||
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
||||||
|
|
||||||
- APIs
|
- APIs
|
||||||
- An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture)
|
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
|
||||||
- Support a lot of country specific features:
|
- Support a lot of country specific features:
|
||||||
- Spanish Tax RE and ISPF
|
- Spanish Tax RE and ISPF
|
||||||
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
|
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
|
||||||
@ -149,7 +153,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
|||||||
- Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
|
- Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
|
||||||
- Compatible with European GDPR rules
|
- Compatible with European GDPR rules
|
||||||
- ...
|
- ...
|
||||||
- PDF or ODT generation for invoice, proposals, orders...
|
- Flexible PDF & ODT generation for invoices, proposals, orders...
|
||||||
- …
|
- …
|
||||||
|
|
||||||
### System Environment / Requirements
|
### System Environment / Requirements
|
||||||
@ -167,12 +171,12 @@ These are features that Dolibarr does **not** yet fully support:
|
|||||||
|
|
||||||
- Tasks dependencies in projects
|
- Tasks dependencies in projects
|
||||||
- Payroll module
|
- Payroll module
|
||||||
- No native embedded Webmail
|
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
|
||||||
- Dolibarr can't do coffee (yet)
|
- Dolibarr can't do coffee (yet)
|
||||||
|
|
||||||
## DOCUMENTATION
|
## DOCUMENTATION
|
||||||
|
|
||||||
Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](https://wiki.dolibarr.org).
|
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
|
||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUTING
|
||||||
|
|
||||||
@ -182,7 +186,7 @@ This project exists thanks to all the people who contribute. [[Contribute](https
|
|||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|
||||||
Dolibarr is the work of many contributors over the years and uses some fine libraries.
|
Dolibarr is the work of many contributors over the years and uses some fine PHP libraries.
|
||||||
|
|
||||||
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
|
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Architecture: all
|
|||||||
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5 | libapache2-mod-php | libapache2-mod-phpfilter | php-cgi | php-fpm | php,
|
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5 | libapache2-mod-php | libapache2-mod-phpfilter | php-cgi | php-fpm | php,
|
||||||
php5-cli | php-cli,
|
php5-cli | php-cli,
|
||||||
# Required PHP extensions
|
# Required PHP extensions
|
||||||
php5-mysql | php5-mysqli | php-mysql | php-mysqli, php5-curl | php-curl, php5-gd | php-gd, php5-ldap | php-gd,
|
php5-mysql | php5-mysqli | php-mysql | php-mysqli, php5-curl | php-curl, php5-gd | php-gd, php5-ldap | php-gd, php5-zip | php-zip,
|
||||||
# Required PHP libraries
|
# Required PHP libraries
|
||||||
php-pear, php-mail-mime,
|
php-pear, php-mail-mime,
|
||||||
# php-tcpdf,
|
# php-tcpdf,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ ALL:
|
|||||||
Check "@CHANGE"
|
Check "@CHANGE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PrestaShopWebservice:
|
PrestaShopWebservice:
|
||||||
---------------------
|
---------------------
|
||||||
Replace
|
Replace
|
||||||
@ -27,6 +28,19 @@ With
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DEBUGBAR:
|
||||||
|
---------
|
||||||
|
|
||||||
|
Move
|
||||||
|
this.options = {
|
||||||
|
bodyMarginBottom: true,
|
||||||
|
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
|
||||||
|
};
|
||||||
|
few line lower in the
|
||||||
|
initialize: function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ESCPOS:
|
ESCPOS:
|
||||||
-------
|
-------
|
||||||
Replace
|
Replace
|
||||||
@ -167,6 +181,7 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
|||||||
TCPDI:
|
TCPDI:
|
||||||
------
|
------
|
||||||
Add fpdf_tpl.php 1.2
|
Add fpdf_tpl.php 1.2
|
||||||
|
|
||||||
Add tcpdi.php
|
Add tcpdi.php
|
||||||
|
|
||||||
Add tcpdi_parser.php and replace:
|
Add tcpdi_parser.php and replace:
|
||||||
@ -205,8 +220,6 @@ with
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JCROP:
|
JCROP:
|
||||||
------
|
------
|
||||||
* Remove analytics tag into file index.html
|
* Remove analytics tag into file index.html
|
||||||
|
|||||||
172
dev/resources/sepa/sample-credit-transfer.xml
Normal file
172
dev/resources/sepa/sample-credit-transfer.xml
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
|
||||||
|
<CstmrCdtTrfInitn>
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>message-id-001</MsgId>
|
||||||
|
<CreDtTm>2010-09-28T14:07:00</CreDtTm>
|
||||||
|
<NbOfTxs>1</NbOfTxs>
|
||||||
|
<CtrlSum>10.1</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>Bedrijfsnaam</Nm>
|
||||||
|
<Id>
|
||||||
|
<OrgId>
|
||||||
|
<Othr>
|
||||||
|
<Id>123456789123456</Id>
|
||||||
|
</Othr>
|
||||||
|
</OrgId>
|
||||||
|
</Id>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>minimaal gevuld</PmtInfId>
|
||||||
|
<PmtMtd>TRF</PmtMtd>
|
||||||
|
<NbOfTxs>1</NbOfTxs>
|
||||||
|
<CtrlSum>10.1</CtrlSum>
|
||||||
|
<ReqdExctnDt>2009-11-01</ReqdExctnDt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>Naam</Nm>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>NL44RABO0123456789</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>RABONL2U</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<CdtTrfTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>non ref</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<Amt>
|
||||||
|
<InstdAmt Ccy="EUR">10.1</InstdAmt>
|
||||||
|
</Amt>
|
||||||
|
<ChrgBr>SLEV</ChrgBr>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>ABNANL2A</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<Cdtr>
|
||||||
|
<Nm>Naam creditor</Nm>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>NL90ABNA0111111111</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>vrije tekst</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</CdtTrfTxInf>
|
||||||
|
</PmtInf>
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>maximaal gevuld</PmtInfId>
|
||||||
|
<PmtMtd>TRF</PmtMtd>
|
||||||
|
<BtchBookg>true</BtchBookg>
|
||||||
|
<NbOfTxs>1</NbOfTxs>
|
||||||
|
<CtrlSum>20.2</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<InstrPrty>NORM</InstrPrty>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
<LclInstrm>
|
||||||
|
<Cd>IDEAL</Cd>
|
||||||
|
</LclInstrm>
|
||||||
|
<CtgyPurp>
|
||||||
|
<Cd>SECU</Cd>
|
||||||
|
</CtgyPurp>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdExctnDt>2009-11-01</ReqdExctnDt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>Naam</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>NL</Ctry>
|
||||||
|
<AdrLine>Debtor straat 1</AdrLine>
|
||||||
|
<AdrLine>9999 XX Plaats debtor</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>NL44RABO0123456789</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>RABONL2U</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<UltmtDbtr>
|
||||||
|
<Id>
|
||||||
|
<OrgId>
|
||||||
|
<Othr>
|
||||||
|
<Id>12345678</Id>
|
||||||
|
<SchmeNm>
|
||||||
|
<Prtry>klantnummer</Prtry>
|
||||||
|
</SchmeNm>
|
||||||
|
<Issr>klantnummer uitgifte instantie</Issr>
|
||||||
|
</Othr>
|
||||||
|
</OrgId>
|
||||||
|
</Id>
|
||||||
|
</UltmtDbtr>
|
||||||
|
<ChrgBr>SLEV</ChrgBr>
|
||||||
|
<CdtTrfTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<InstrId>debtor-to-debtor-bank-01</InstrId>
|
||||||
|
<EndToEndId>End-to-end-id-debtor-to-creditor-01</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<Amt>
|
||||||
|
<InstdAmt Ccy="EUR">20.2</InstdAmt>
|
||||||
|
</Amt>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>ABNANL2A</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<Cdtr>
|
||||||
|
<Nm>Naam creditor</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>NL</Ctry>
|
||||||
|
<AdrLine>Straat creditor 1</AdrLine>
|
||||||
|
<AdrLine>9999 XX Plaats creditor</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>NL90ABNA0111111111</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<UltmtCdtr>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<DtAndPlcOfBirth>
|
||||||
|
<BirthDt>1969-07-03</BirthDt>
|
||||||
|
<CityOfBirth>PLAATS</CityOfBirth>
|
||||||
|
<CtryOfBirth>NL</CtryOfBirth>
|
||||||
|
</DtAndPlcOfBirth>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</UltmtCdtr>
|
||||||
|
<Purp>
|
||||||
|
<Cd>CHAR</Cd>
|
||||||
|
</Purp>
|
||||||
|
<RmtInf>
|
||||||
|
<Strd>
|
||||||
|
<CdtrRefInf>
|
||||||
|
<Tp>
|
||||||
|
<CdOrPrtry>
|
||||||
|
<Cd>SCOR</Cd>
|
||||||
|
</CdOrPrtry>
|
||||||
|
<Issr>CUR</Issr>
|
||||||
|
</Tp>
|
||||||
|
<Ref>1234567</Ref>
|
||||||
|
</CdtrRefInf>
|
||||||
|
</Strd>
|
||||||
|
</RmtInf>
|
||||||
|
</CdtTrfTxInf>
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrCdtTrfInitn>
|
||||||
|
</Document>
|
||||||
@ -1,2 +1,8 @@
|
|||||||
|
Spec for credit transfer:
|
||||||
|
https://docs.oracle.com/cd/E39124_01/doc.91/e60210/fields_sepa_pay_file_appx.htm#EOAEL00515
|
||||||
|
|
||||||
|
To validate a SEPA file:
|
||||||
|
xmllint --schema pain.001.001.03.xsd T200801.xml --noout
|
||||||
|
|
||||||
To test a SEPA file:
|
To test a SEPA file:
|
||||||
https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa
|
https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa
|
||||||
|
|||||||
@ -79,6 +79,7 @@ $object = new Fiscalyear($db);
|
|||||||
$max = 100;
|
$max = 100;
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$fiscalyearstatic = new Fiscalyear($db);
|
||||||
|
|
||||||
$title = $langs->trans('AccountingPeriods');
|
$title = $langs->trans('AccountingPeriods');
|
||||||
$helpurl = "";
|
$helpurl = "";
|
||||||
@ -132,13 +133,15 @@ if ($result)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($num) {
|
if ($num) {
|
||||||
$fiscalyearstatic = new Fiscalyear($db);
|
|
||||||
|
|
||||||
while ($i < $num && $i < $max) {
|
while ($i < $num && $i < $max) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
$fiscalyearstatic->id = $obj->rowid;
|
$fiscalyearstatic->id = $obj->rowid;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td><a href="fiscalyear_card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowFiscalYear"), "technic").' '.$obj->rowid.'</a></td>';
|
print '<td>';
|
||||||
|
print $fiscalyearstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
print '<td class="left">'.$obj->label.'</td>';
|
print '<td class="left">'.$obj->label.'</td>';
|
||||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_start), 'day').'</td>';
|
print '<td class="left">'.dol_print_date($db->jdate($obj->date_start), 'day').'</td>';
|
||||||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>';
|
print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>';
|
||||||
|
|||||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -78,6 +79,7 @@ if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
|
|||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
$hookmanager->initHooks(array('bookkeepingbyaccountlist'));
|
$hookmanager->initHooks(array('bookkeepingbyaccountlist'));
|
||||||
|
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
@ -543,7 +545,7 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
// Show the break account
|
// Show the break account
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td colspan="'.$totalarray['nbfield'].'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||||
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
|
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
|
||||||
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -263,7 +263,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||||
$bookkeeping->code_journal = $journal;
|
$bookkeeping->code_journal = $journal;
|
||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
@ -610,7 +610,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
} else print $accountoshow;
|
} else print $accountoshow;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."</td>";
|
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."</td>";
|
||||||
print '<td class="right nowraponall">'.($mt < 0 ? -price(-$mt) : '')."</td>";
|
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,6 +88,7 @@ if ($action == 'update' || $action == 'add') {
|
|||||||
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
|
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
|
||||||
|
|
||||||
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
|
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
|
||||||
|
$constvalue = preg_replace('/:member$/', '', $constvalue);
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
|
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
|
||||||
|
|
||||||
@ -100,23 +101,6 @@ if ($action == 'update' || $action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action to enable a submodule of the adherent module
|
|
||||||
if ($action == 'set') {
|
|
||||||
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
|
|
||||||
if ($result < 0) {
|
|
||||||
print $db->error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Action to disable a submodule of the adherent module
|
|
||||||
if ($action == 'unset') {
|
|
||||||
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
|
|
||||||
if ($result < 0) {
|
|
||||||
print $db->error();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -890,7 +890,10 @@ if ($rowid > 0) {
|
|||||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
|
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
|
||||||
$prodtmp = new Product($db);
|
$prodtmp = new Product($db);
|
||||||
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessage($prodtmp->error, 'errors');
|
||||||
|
}
|
||||||
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
|
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -912,7 +915,10 @@ if ($rowid > 0) {
|
|||||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
|
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
|
||||||
$prodtmp = new Product($db);
|
$prodtmp = new Product($db);
|
||||||
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessage($prodtmp->error, 'errors');
|
||||||
|
}
|
||||||
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
|
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -68,7 +68,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_valu
|
|||||||
print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
|
|
||||||
$head = bomAdminPrepareHead(null);
|
$head = bomAdminPrepareHead();
|
||||||
|
|
||||||
dol_fiche_head($head, 'bom_extrafields', $langs->trans("ExtraFields"), -1, 'account');
|
dol_fiche_head($head, 'bom_extrafields', $langs->trans("ExtraFields"), -1, 'account');
|
||||||
|
|
||||||
|
|||||||
@ -314,7 +314,7 @@ $boxactivated = InfoBox::listBoxes($db, 'activated', -1, null);
|
|||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||||
print load_fiche_titre($langs->trans("BoxesAvailable"));
|
print load_fiche_titre($langs->trans("BoxesAvailable"), '', '');
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||||
@ -377,7 +377,7 @@ print "\n".'<!-- End Boxes Available -->'."\n";
|
|||||||
|
|
||||||
//var_dump($boxactivated);
|
//var_dump($boxactivated);
|
||||||
print "<br>\n\n";
|
print "<br>\n\n";
|
||||||
print load_fiche_titre($langs->trans("BoxesActivated"));
|
print load_fiche_titre($langs->trans("BoxesActivated"), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="tagtable liste">'."\n";
|
print '<table class="tagtable liste">'."\n";
|
||||||
@ -436,7 +436,7 @@ print '<br>';
|
|||||||
// Other parameters
|
// Other parameters
|
||||||
|
|
||||||
print "\n\n".'<!-- Other Const -->'."\n";
|
print "\n\n".'<!-- Other Const -->'."\n";
|
||||||
print load_fiche_titre($langs->trans("Other"));
|
print load_fiche_titre($langs->trans("Other"), '', '');
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="addconst">';
|
print '<input type="hidden" name="action" value="addconst">';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
* Copyright (C) 2005-2020 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -33,6 +33,10 @@ if (!$user->admin) accessforbidden();
|
|||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
|
if (! in_array('clicktodial', $conf->modules)) {
|
||||||
|
accessforbidden($langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name")));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -56,6 +60,8 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
$user->fetch_clicktodial();
|
$user->fetch_clicktodial();
|
||||||
|
|
||||||
$wikihelp = 'EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es';
|
$wikihelp = 'EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es';
|
||||||
@ -71,6 +77,7 @@ print '<form method="post" action="clicktodial.php">';
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="setvalue">';
|
print '<input type="hidden" name="action" value="setvalue">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
print '<td>'.$langs->trans("Name").'</td>';
|
||||||
@ -103,6 +110,7 @@ print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
|
print '<div class="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
|
||||||
|
|
||||||
|
|||||||
@ -109,6 +109,12 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
|||||||
|
|
||||||
foreach ($arrayofimages as $varforimage)
|
foreach ($arrayofimages as $varforimage)
|
||||||
{
|
{
|
||||||
|
if ($_FILES[$varforimage]["name"] && ! preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ($_FILES[$varforimage]["tmp_name"])
|
if ($_FILES[$varforimage]["tmp_name"])
|
||||||
{
|
{
|
||||||
$reg = array();
|
$reg = array();
|
||||||
@ -473,11 +479,18 @@ if (!empty($mysoc->logo_mini)) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||||
|
} elseif (!empty($mysoc->logo)) {
|
||||||
|
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
|
||||||
|
print '<div class="inline-block valignmiddle">';
|
||||||
|
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="inline-block valignmiddle">';
|
print '<div class="inline-block valignmiddle">';
|
||||||
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -493,11 +506,19 @@ if (!empty($mysoc->logo_squarred_mini)) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||||
} else {
|
} elseif (!empty($mysoc->logo_squarred)) {
|
||||||
|
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
|
||||||
|
print '<div class="inline-block valignmiddle">';
|
||||||
|
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
print '<div class="inline-block valignmiddle">';
|
print '<div class="inline-block valignmiddle">';
|
||||||
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -92,7 +92,7 @@ print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'sending');
|
dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'shipment');
|
||||||
|
|
||||||
// Miscellaneous parameters
|
// Miscellaneous parameters
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -90,7 +91,11 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||||
|
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
|
||||||
|
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
|
||||||
|
} else {
|
||||||
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 27, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
|
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 27, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname = array();
|
$tabname = array();
|
||||||
@ -133,6 +138,8 @@ $tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat";
|
|||||||
$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
|
$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
|
||||||
$tabname[37] = MAIN_DB_PREFIX."c_units";
|
$tabname[37] = MAIN_DB_PREFIX."c_units";
|
||||||
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
|
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
|
||||||
|
$tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||||
|
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
|
||||||
|
|
||||||
// Dictionary labels
|
// Dictionary labels
|
||||||
$tablib = array();
|
$tablib = array();
|
||||||
@ -174,6 +181,8 @@ $tablib[35] = "DictionaryExpenseTaxCat";
|
|||||||
$tablib[36] = "DictionaryExpenseTaxRange";
|
$tablib[36] = "DictionaryExpenseTaxRange";
|
||||||
$tablib[37] = "DictionaryMeasuringUnits";
|
$tablib[37] = "DictionaryMeasuringUnits";
|
||||||
$tablib[38] = "DictionarySocialNetworks";
|
$tablib[38] = "DictionarySocialNetworks";
|
||||||
|
$tablib[39] = "DictionaryProspectContactLevel";
|
||||||
|
$tablib[40] = "DictionaryProspectContactStatus";
|
||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql = array();
|
$tabsql = array();
|
||||||
@ -203,7 +212,7 @@ $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as
|
|||||||
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
||||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
//$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, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||||
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
$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[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";
|
||||||
@ -215,6 +224,8 @@ $tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX
|
|||||||
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||||
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||||
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||||
|
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||||
|
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort = array();
|
$tabsqlsort = array();
|
||||||
@ -256,6 +267,8 @@ $tabsqlsort[35] = "c.label ASC";
|
|||||||
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||||
$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
|
$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||||
$tabsqlsort[38] = "rowid, code ASC";
|
$tabsqlsort[38] = "rowid, code ASC";
|
||||||
|
$tabsqlsort[39] = "sortorder ASC";
|
||||||
|
$tabsqlsort[40] = "code ASC";
|
||||||
|
|
||||||
// Field names in select result for dictionary display
|
// Field names in select result for dictionary display
|
||||||
$tabfield = array();
|
$tabfield = array();
|
||||||
@ -285,7 +298,7 @@ $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell
|
|||||||
$tabfield[24] = "code,label";
|
$tabfield[24] = "code,label";
|
||||||
$tabfield[25] = "code,label";
|
$tabfield[25] = "code,label";
|
||||||
//$tabfield[26]= "code,label,short_label";
|
//$tabfield[26]= "code,label,short_label";
|
||||||
$tabfield[27] = "code,libelle";
|
$tabfield[27] = "code,libelle,picto";
|
||||||
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country";
|
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country";
|
||||||
$tabfield[29] = "code,label,percent,position";
|
$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[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
@ -297,6 +310,8 @@ $tabfield[35] = "label";
|
|||||||
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
|
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
|
||||||
$tabfield[37] = "code,label,short_label,unit_type,scale";
|
$tabfield[37] = "code,label,short_label,unit_type,scale";
|
||||||
$tabfield[38] = "code,label,url,icon,entity";
|
$tabfield[38] = "code,label,url,icon,entity";
|
||||||
|
$tabfield[39] = "code,libelle,sortorder";
|
||||||
|
$tabfield[40] = "code,libelle,picto";
|
||||||
|
|
||||||
// Edit field names for editing a record
|
// Edit field names for editing a record
|
||||||
$tabfieldvalue = array();
|
$tabfieldvalue = array();
|
||||||
@ -326,7 +341,7 @@ $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accou
|
|||||||
$tabfieldvalue[24] = "code,label";
|
$tabfieldvalue[24] = "code,label";
|
||||||
$tabfieldvalue[25] = "code,label";
|
$tabfieldvalue[25] = "code,label";
|
||||||
//$tabfieldvalue[26]= "code,label,short_label";
|
//$tabfieldvalue[26]= "code,label,short_label";
|
||||||
$tabfieldvalue[27] = "code,libelle";
|
$tabfieldvalue[27] = "code,libelle,picto";
|
||||||
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country";
|
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country";
|
||||||
$tabfieldvalue[29] = "code,label,percent,position";
|
$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[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
@ -338,6 +353,8 @@ $tabfieldvalue[35] = "label";
|
|||||||
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
|
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
|
||||||
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
|
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
|
||||||
$tabfieldvalue[38] = "code,label,url,icon";
|
$tabfieldvalue[38] = "code,label,url,icon";
|
||||||
|
$tabfieldvalue[39] = "code,libelle,sortorder";
|
||||||
|
$tabfieldvalue[40] = "code,libelle,picto";
|
||||||
|
|
||||||
// Field names in the table for inserting a record
|
// Field names in the table for inserting a record
|
||||||
$tabfieldinsert = array();
|
$tabfieldinsert = array();
|
||||||
@ -367,7 +384,7 @@ $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,acco
|
|||||||
$tabfieldinsert[24] = "code,label";
|
$tabfieldinsert[24] = "code,label";
|
||||||
$tabfieldinsert[25] = "code,label";
|
$tabfieldinsert[25] = "code,label";
|
||||||
//$tabfieldinsert[26]= "code,label,short_label";
|
//$tabfieldinsert[26]= "code,label,short_label";
|
||||||
$tabfieldinsert[27] = "code,libelle";
|
$tabfieldinsert[27] = "code,libelle,picto";
|
||||||
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country";
|
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country";
|
||||||
$tabfieldinsert[29] = "code,label,percent,position";
|
$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[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
@ -380,6 +397,8 @@ $tabfieldinsert[35] = "label";
|
|||||||
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
|
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
|
||||||
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
|
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
|
||||||
$tabfieldinsert[38] = "code,label,url,icon,entity";
|
$tabfieldinsert[38] = "code,label,url,icon,entity";
|
||||||
|
$tabfieldinsert[39] = "code,label,sortorder";
|
||||||
|
$tabfieldinsert[40] = "code,libelle,picto";
|
||||||
|
|
||||||
// Rowid name of field depending if field is autoincrement on or off..
|
// Rowid name of field depending if field is autoincrement on or off..
|
||||||
// Use "" if id field is "rowid" and has autoincrement on
|
// Use "" if id field is "rowid" and has autoincrement on
|
||||||
@ -423,6 +442,8 @@ $tabrowid[35] = "";
|
|||||||
$tabrowid[36] = "";
|
$tabrowid[36] = "";
|
||||||
$tabrowid[37] = "";
|
$tabrowid[37] = "";
|
||||||
$tabrowid[38] = "";
|
$tabrowid[38] = "";
|
||||||
|
$tabrowid[39] = "code";
|
||||||
|
$tabrowid[40] = "id";
|
||||||
|
|
||||||
// Condition to show dictionary in setup page
|
// Condition to show dictionary in setup page
|
||||||
$tabcond = array();
|
$tabcond = array();
|
||||||
@ -464,6 +485,8 @@ $tabcond[35] = !empty($conf->expensereport->enabled);
|
|||||||
$tabcond[36] = !empty($conf->expensereport->enabled);
|
$tabcond[36] = !empty($conf->expensereport->enabled);
|
||||||
$tabcond[37] = !empty($conf->product->enabled);
|
$tabcond[37] = !empty($conf->product->enabled);
|
||||||
$tabcond[38] = !empty($conf->socialnetworks->enabled);
|
$tabcond[38] = !empty($conf->socialnetworks->enabled);
|
||||||
|
$tabcond[39] = (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
|
||||||
|
$tabcond[40] = ! empty($conf->societe->enabled);
|
||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp = array();
|
$tabhelp = array();
|
||||||
@ -493,7 +516,7 @@ $tabhelp[23] = array('revenuestamp_type'=>'FixedOrPercent');
|
|||||||
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
|
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
|
||||||
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"),'picto'=>$langs->trans("PictoHelp"));
|
||||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
||||||
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||||
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
|
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
|
||||||
@ -505,6 +528,8 @@ $tabhelp[35] = array();
|
|||||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
|
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
|
||||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
||||||
|
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
|
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"),'picto'=>$langs->trans("PictoHelp"));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck = array();
|
$tabfieldcheck = array();
|
||||||
@ -546,6 +571,8 @@ $tabfieldcheck[35] = array();
|
|||||||
$tabfieldcheck[36] = array();
|
$tabfieldcheck[36] = array();
|
||||||
$tabfieldcheck[37] = array();
|
$tabfieldcheck[37] = array();
|
||||||
$tabfieldcheck[38] = array();
|
$tabfieldcheck[38] = array();
|
||||||
|
$tabfieldcheck[39] = array();
|
||||||
|
$tabfieldcheck[40] = array();
|
||||||
|
|
||||||
// Complete all arrays with entries found into modules
|
// Complete all arrays with entries found into modules
|
||||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
||||||
@ -647,7 +674,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($value == 'dayrule' && empty($_POST['dayrule'])) continue;
|
if ($value == 'dayrule' && empty($_POST['dayrule'])) continue;
|
||||||
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
|
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
|
||||||
if ((!isset($_POST[$value]) || $_POST[$value] == '')
|
if ((!isset($_POST[$value]) || $_POST[$value] == '')
|
||||||
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking')) // Fields that are not mandatory
|
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
|
||||||
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -102,7 +102,7 @@ print '<input type="hidden" name="action" value="save">';
|
|||||||
|
|
||||||
$head = security_prepare_head();
|
$head = security_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);
|
dol_fiche_head($head, 'audit', '', -1);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
|
|||||||
@ -184,7 +184,7 @@ print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'sending');
|
dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'shipment');
|
||||||
|
|
||||||
// Shipment numbering model
|
// Shipment numbering model
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ print "<br>\n";
|
|||||||
|
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), -1, 'sending');
|
dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), -1, 'shipment');
|
||||||
|
|
||||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ print "<br>\n";
|
|||||||
|
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), -1, 'sending');
|
dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), -1, 'shipment');
|
||||||
|
|
||||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -34,11 +34,21 @@ if (!$user->admin) accessforbidden();
|
|||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$currencycode = GETPOST('currencycode', 'alpha');
|
$currencycode = GETPOST('currencycode', 'alpha');
|
||||||
|
|
||||||
|
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
|
||||||
|
// When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
|
||||||
|
$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
|
||||||
|
}
|
||||||
|
|
||||||
$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
|
$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
|
||||||
$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
|
$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
|
||||||
$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : '');
|
$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : '');
|
||||||
$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
|
$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
|
||||||
|
|
||||||
|
$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int');
|
||||||
|
$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int');
|
||||||
|
$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int');
|
||||||
|
$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alpha'));
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -60,9 +70,9 @@ if ($action == 'update')
|
|||||||
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
|
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST[$mainroundingruletot])
|
if ($valmainroundingruletot)
|
||||||
{
|
{
|
||||||
if ($_POST[$mainroundingruletot] * pow(10, $_POST[$mainmaxdecimalstot]) < 1)
|
if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error++;
|
$error++;
|
||||||
@ -72,11 +82,11 @@ if ($action == 'update')
|
|||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, $mainmaxdecimalsunit, $_POST[$mainmaxdecimalsunit], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, $mainmaxdecimalstot, $_POST[$mainmaxdecimalstot], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, $mainmaxdecimalsshown, $_POST[$mainmaxdecimalsshown], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, $mainroundingruletot, $_POST[$mainroundingruletot], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '¤cycode='.$currencycode : ''));
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '¤cycode='.$currencycode : ''));
|
||||||
exit;
|
exit;
|
||||||
@ -94,7 +104,6 @@ llxHeader();
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup');
|
print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup');
|
||||||
|
|
||||||
$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
|
|
||||||
$aCurrencies = array($conf->currency); // Default currency always first position
|
$aCurrencies = array($conf->currency); // Default currency always first position
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY))
|
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY))
|
||||||
@ -232,9 +241,9 @@ if (empty($mysoc->country_code))
|
|||||||
// Add vat rates examples specific to country
|
// Add vat rates examples specific to country
|
||||||
$vat_rates = array();
|
$vat_rates = array();
|
||||||
|
|
||||||
$sql = "SELECT taux as vat_rate";
|
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND t.taux <> 0";
|
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
|
||||||
$sql .= " ORDER BY t.taux ASC";
|
$sql .= " ORDER BY t.taux ASC";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -245,23 +254,31 @@ if (empty($mysoc->country_code))
|
|||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$vat_rates[$i] = $obj->vat_rate;
|
$vat_rates[] = array('vat_rate'=>$obj->vat_rate, 'code'=>$obj->vat_code, 'localtax_rate1'=>$obj->localtax_rate1, 'locltax_rate2'=>$obj->localtax_rate2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else dol_print_error($db);
|
} else dol_print_error($db);
|
||||||
|
|
||||||
if (count($vat_rates))
|
if (count($vat_rates))
|
||||||
{
|
{
|
||||||
foreach ($vat_rates as $vat)
|
foreach ($vat_rates as $vatarray)
|
||||||
{
|
{
|
||||||
|
$vat = $vatarray['vat_rate'];
|
||||||
for ($qty = 1; $qty <= 2; $qty++)
|
for ($qty = 1; $qty <= 2; $qty++)
|
||||||
{
|
{
|
||||||
|
$vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
|
||||||
|
|
||||||
|
$localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
|
||||||
|
|
||||||
$s = 10 / 3;
|
$s = 10 / 3;
|
||||||
$tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
|
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
|
||||||
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
|
||||||
|
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
|
||||||
|
print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
|
||||||
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -269,69 +286,22 @@ if (empty($mysoc->country_code))
|
|||||||
// This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
|
// This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
|
||||||
// were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
|
// were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
|
||||||
|
|
||||||
|
$localtax_array = array();
|
||||||
|
|
||||||
$s = 10 / 3; $qty = 1; $vat = 10;
|
$s = 10 / 3; $qty = 1; $vat = 10;
|
||||||
$tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
|
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
|
||||||
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||||
|
|
||||||
$s = 10 / 3; $qty = 2; $vat = 10;
|
$s = 10 / 3; $qty = 2; $vat = 10;
|
||||||
$tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
|
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
|
||||||
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
|
||||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
print " x ".$langs->trans("Quantity").": ".$qty;
|
||||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||||
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
print ' -> <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Important: can debug rounding, to simulate the rounded total
|
|
||||||
/*
|
|
||||||
print '<br><b>'.$langs->trans("VATRoundedByLine").' ('.$langs->trans("DolibarrDefault").')</b><br>';
|
|
||||||
|
|
||||||
foreach($vat_rates as $vat)
|
|
||||||
{
|
|
||||||
for ($qty=1; $qty<=2; $qty++)
|
|
||||||
{
|
|
||||||
$s1=10/3;
|
|
||||||
$s2=2/7;
|
|
||||||
|
|
||||||
// Round by line
|
|
||||||
$tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc);
|
|
||||||
$tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc);
|
|
||||||
$total_ht = $tmparray1[0] + $tmparray2[0];
|
|
||||||
$total_tva = $tmparray1[1] + $tmparray2[1];
|
|
||||||
$total_ttc = $tmparray1[2] + $tmparray2[2];
|
|
||||||
|
|
||||||
print $langs->trans("UnitPriceOfProduct").": ".(price2num($s1,'MU') + price2num($s2,'MU'));
|
|
||||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
|
||||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
|
||||||
print " -> ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."<br>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<br><b>'.$langs->trans("VATRoundedOnTotal").'</b><br>';
|
|
||||||
|
|
||||||
foreach($vat_rates as $vat)
|
|
||||||
{
|
|
||||||
for ($qty=1; $qty<=2; $qty++)
|
|
||||||
{
|
|
||||||
$s1=10/3;
|
|
||||||
$s2=2/7;
|
|
||||||
|
|
||||||
// Global round
|
|
||||||
$subtotal_ht = (($qty*price2num($s1,'MU')) + ($qty*price2num($s2,'MU')));
|
|
||||||
$tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0,$mysoc);
|
|
||||||
$total_ht = $tmparray3[0];
|
|
||||||
$total_tva = $tmparray3[1];
|
|
||||||
$total_ttc = $tmparray3[2];
|
|
||||||
|
|
||||||
print $langs->trans("UnitPriceOfProduct").": ".price2num($s1+$s2,'MU');
|
|
||||||
print " x ".$langs->trans("Quantity").": ".$qty;
|
|
||||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
|
||||||
print " -> ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."<br>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -179,7 +179,7 @@ print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), -1, 'sending');
|
dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), -1, 'shipment');
|
||||||
|
|
||||||
|
|
||||||
// Delivery numbering model
|
// Delivery numbering model
|
||||||
|
|||||||
@ -76,7 +76,7 @@ print "<br>\n";
|
|||||||
|
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), -1, 'sending');
|
dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), -1, 'shipment');
|
||||||
|
|
||||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ print "<br>\n";
|
|||||||
|
|
||||||
$head = expedition_admin_prepare_head();
|
$head = expedition_admin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), -1, 'sending');
|
dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), -1, 'shipment');
|
||||||
|
|
||||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
|||||||
@ -153,20 +153,20 @@ $sourceList = array();
|
|||||||
|
|
||||||
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
if ($conf->propal->enabled) $elementList['propal_send'] = $langs->trans('MailToSendProposal');
|
if ($conf->propal->enabled && $user->rights->propal->lire) $elementList['propal_send'] = $langs->trans('MailToSendProposal');
|
||||||
if ($conf->commande->enabled) $elementList['order_send'] = $langs->trans('MailToSendOrder');
|
if ($conf->commande->enabled && $user->rights->commande->lire) $elementList['order_send'] = $langs->trans('MailToSendOrder');
|
||||||
if ($conf->facture->enabled) $elementList['facture_send'] = $langs->trans('MailToSendInvoice');
|
if ($conf->facture->enabled && $user->rights->facture->lire) $elementList['facture_send'] = $langs->trans('MailToSendInvoice');
|
||||||
if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->trans('MailToSendShipment');
|
if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->trans('MailToSendShipment');
|
||||||
if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception');
|
if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception');
|
||||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention');
|
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention');
|
||||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation');
|
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation');
|
||||||
if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
|
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
|
||||||
if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_invoice->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
|
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
|
||||||
if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->trans('MailToThirdparty');
|
if ($conf->societe->enabled && $user->rights->societe->lire) $elementList['thirdparty'] = $langs->trans('MailToThirdparty');
|
||||||
if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember');
|
if ($conf->adherent->enabled && $user->rights->adherent->lire) $elementList['member'] = $langs->trans('MailToMember');
|
||||||
if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract');
|
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementList['contract'] = $langs->trans('MailToSendContract');
|
||||||
if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject');
|
if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject');
|
||||||
if ($conf->ticket->enabled) $elementList['ticket_send'] = $langs->trans('MailToTicket');
|
if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = $langs->trans('MailToTicket');
|
||||||
$elementList['user'] = $langs->trans('MailToUser');
|
$elementList['user'] = $langs->trans('MailToUser');
|
||||||
|
|
||||||
$parameters = array('elementList'=>$elementList);
|
$parameters = array('elementList'=>$elementList);
|
||||||
@ -544,6 +544,7 @@ if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforco
|
|||||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||||
{
|
{
|
||||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
if ($tmpfieldlist == 'topic')
|
if ($tmpfieldlist == 'topic')
|
||||||
{
|
{
|
||||||
@ -557,6 +558,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
|
|||||||
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||||
if ($tmpfieldlist == 'content_lines')
|
if ($tmpfieldlist == 'content_lines')
|
||||||
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||||
|
|
||||||
// Input field
|
// Input field
|
||||||
if ($tmpfieldlist == 'topic') {
|
if ($tmpfieldlist == 'topic') {
|
||||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
||||||
@ -633,30 +635,34 @@ if ($resql)
|
|||||||
|
|
||||||
// Title line with search boxes
|
// Title line with search boxes
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
$filterfound = 0;
|
$filterfound = 0;
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
|
if ($value == 'label') {
|
||||||
elseif ($value == 'lang')
|
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
{
|
} elseif ($value == 'lang') {
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
|
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} elseif ($value == 'fk_user')
|
} elseif ($value == 'fk_user') {
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
$restrictid = array();
|
$restrictid = array();
|
||||||
if (!$user->admin) $restrictid = array($user->id);
|
if (!$user->admin) $restrictid = array($user->id);
|
||||||
//var_dump($restrictid);
|
//var_dump($restrictid);
|
||||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
|
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
} elseif ($value == 'topic') {
|
||||||
elseif ($value == 'type_template')
|
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||||
{
|
} elseif ($value == 'type_template') {
|
||||||
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
|
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
|
||||||
} elseif (!in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
} elseif (!in_array($value, array('content', 'content_lines'))) {
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||||
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre right" width="64">';
|
print '<td class="liste_titre right" width="64">';
|
||||||
$searchpicto = $form->showFilterButtons();
|
$searchpicto = $form->showFilterButtons();
|
||||||
|
|||||||
@ -151,7 +151,7 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'handler', $langs->trans("Menus"), -1);
|
dol_fiche_head($head, 'handler', '', -1);
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("MenusDesc")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("MenusDesc")."</span><br>\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|||||||
@ -229,7 +229,7 @@ $head[$h][1] = $langs->trans("Miscellaneous");
|
|||||||
$head[$h][2] = 'misc';
|
$head[$h][2] = 'misc';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, 'editor', $langs->trans("Menus"), -1);
|
dol_fiche_head($head, 'editor', '', -1);
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("MenusEditorDesc")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("MenusEditorDesc")."</span><br>\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|||||||
@ -75,7 +75,7 @@ $head[$h][1] = $langs->trans("Miscellaneous");
|
|||||||
$head[$h][2] = 'misc';
|
$head[$h][2] = 'misc';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, 'misc', $langs->trans("Menus"), -1);
|
dol_fiche_head($head, 'misc', '', -1);
|
||||||
|
|
||||||
|
|
||||||
// Other Options
|
// Other Options
|
||||||
|
|||||||
@ -262,7 +262,7 @@ print '<div class="centpercent">';
|
|||||||
|
|
||||||
$picto = 'object_'.$objMod->picto;
|
$picto = 'object_'.$objMod->picto;
|
||||||
|
|
||||||
print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto);
|
print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0, '', 'titlemodulehelp');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
dol_fiche_head($head, $mode, '', -1);
|
dol_fiche_head($head, $mode, '', -1);
|
||||||
@ -341,7 +341,7 @@ if ($mode == 'feature')
|
|||||||
$text .= '<br><br>';
|
$text .= '<br><br>';
|
||||||
|
|
||||||
$text .= '<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
|
$text .= '<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
|
||||||
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql'));
|
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql', '\.sql\.back'));
|
||||||
if (count($sqlfiles) > 0)
|
if (count($sqlfiles) > 0)
|
||||||
{
|
{
|
||||||
$text .= $langs->trans("Yes").' (';
|
$text .= $langs->trans("Yes").' (';
|
||||||
|
|||||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
||||||
|
|
||||||
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : 'commonkanban';
|
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common');
|
||||||
if (empty($mode)) $mode = 'common';
|
if (empty($mode)) $mode = 'common';
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
//var_dump($_POST);exit;
|
//var_dump($_POST);exit;
|
||||||
@ -497,11 +497,19 @@ if ($mode == 'common' || $mode == 'commonkanban')
|
|||||||
dol_fiche_head($head, $newmode, '', -1);
|
dol_fiche_head($head, $newmode, '', -1);
|
||||||
|
|
||||||
$moreforfilter = '<div class="valignmiddle">';
|
$moreforfilter = '<div class="valignmiddle">';
|
||||||
|
|
||||||
|
$moreforfilter .= '<div class="floatright right pagination"><ul><li>';
|
||||||
|
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'common' ? '' : ' btnTitleSelected')));
|
||||||
|
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'commonkanban' ? '' : ' btnTitleSelected')));
|
||||||
|
$moreforfilter .= '</li></ul></div>';
|
||||||
|
|
||||||
|
$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="">'.$moreinfo.'</span><br><b class="largenumber">'.$moreinfo2.'</b></div>';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
|
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield paddingtop">';
|
||||||
$moreforfilter .= $langs->trans('Keyword').': <input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'">';
|
$moreforfilter .= $langs->trans('Keyword').': <input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'">';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield paddingtop">';
|
||||||
$moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
$moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
|
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||||
@ -510,11 +518,11 @@ if ($mode == 'common' || $mode == 'commonkanban')
|
|||||||
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated'] = $langs->trans("Deprecated");
|
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated'] = $langs->trans("Deprecated");
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental'] = $langs->trans("Experimental");
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental'] = $langs->trans("Experimental");
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development'] = $langs->trans("Development");
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development'] = $langs->trans("Development");
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield paddingtop">';
|
||||||
$moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
$moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
}
|
}
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield paddingtop">';
|
||||||
$moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
$moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= ' ';
|
$moreforfilter .= ' ';
|
||||||
@ -525,13 +533,6 @@ if ($mode == 'common' || $mode == 'commonkanban')
|
|||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="floatright right pagination"><ul><li>';
|
|
||||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'common' ? '' : ' btnTitleSelected')));
|
|
||||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'commonkanban' ? '' : ' btnTitleSelected')));
|
|
||||||
$moreforfilter .= '</li></ul></div>';
|
|
||||||
|
|
||||||
$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="">'.$moreinfo.'</span><br><b class="largenumber">'.$moreinfo2.'</b></div>';
|
|
||||||
|
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
if (!empty($moreforfilter))
|
if (!empty($moreforfilter))
|
||||||
|
|||||||
@ -68,7 +68,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_valu
|
|||||||
print load_fiche_titre($langs->trans("MrpSetupPage"), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans("MrpSetupPage"), $linkback, 'title_setup');
|
||||||
|
|
||||||
|
|
||||||
$head = mrpAdminPrepareHead(null);
|
$head = mrpAdminPrepareHead();
|
||||||
|
|
||||||
dol_fiche_head($head, 'mrp_extrafields', $langs->trans("ExtraFields"), -1, 'account');
|
dol_fiche_head($head, 'mrp_extrafields', $langs->trans("ExtraFields"), -1, 'account');
|
||||||
|
|
||||||
|
|||||||
@ -72,6 +72,7 @@ if ($action == 'update')
|
|||||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"], 'chaine', 0, '', $conf->entity);
|
||||||
@ -82,6 +83,7 @@ if ($action == 'update')
|
|||||||
|
|
||||||
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
exit;
|
exit;
|
||||||
@ -119,9 +121,41 @@ $arraydetailsforpdffoot = array(
|
|||||||
3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
|
3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$s = $langs->trans("LibraryToBuildPDF")."<br>";
|
||||||
|
$i = 0;
|
||||||
|
$pdf = pdf_getInstance('A4');
|
||||||
|
if (class_exists('FPDF') && !class_exists('TCPDF'))
|
||||||
|
{
|
||||||
|
if ($i) $s .= ' + ';
|
||||||
|
$s .= 'FPDF';
|
||||||
|
$s .= ' ('.@constant('FPDF_PATH').')';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if (class_exists('TCPDF'))
|
||||||
|
{
|
||||||
|
if ($i) $s .= ' + ';
|
||||||
|
$s .= 'TCPDF';
|
||||||
|
$s .= ' ('.@constant('TCPDF_PATH').')';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if (class_exists('FPDI'))
|
||||||
|
{
|
||||||
|
if ($i) $s .= ' + ';
|
||||||
|
$s .= 'FPDI';
|
||||||
|
$s .= ' ('.@constant('FPDI_PATH').')';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if (class_exists('TCPDI'))
|
||||||
|
{
|
||||||
|
if ($i) $s .= ' + ';
|
||||||
|
$s .= 'TCPDI';
|
||||||
|
$s .= ' ('.@constant('TCPDI_PATH').')';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
|
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("PDFDesc")."</span><br>\n";
|
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFDesc"), $s)."</span><br>\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$noCountryCode = (empty($mysoc->country_code) ? true : false);
|
$noCountryCode = (empty($mysoc->country_code) ? true : false);
|
||||||
@ -261,6 +295,12 @@ print '<div class="div-table-responsive-no-min">';
|
|||||||
print '<table summary="more" class="noborder centpercent">';
|
print '<table summary="more" class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
// Height of logo
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'</td><td>';
|
||||||
|
print '<input type="text" class="maxwidth50" name="MAIN_DOCUMENTS_LOGO_HEIGHT" value="'.(!empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT) ? $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT : 20).'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
//Desc
|
//Desc
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||||
@ -309,62 +349,6 @@ print '</td></tr>';
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Library
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
print load_fiche_titre($langs->trans("Library"), '', '');
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
print '<table class="noborder centpercent">'."\n";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">'."\n";
|
|
||||||
print '<td>'.$langs->trans("Name").'</td>'."\n";
|
|
||||||
print '<td>'.$langs->trans("Value").'</td>'."\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="oddeven">'."\n";
|
|
||||||
print '<td>'.$langs->trans("LibraryToBuildPDF").'</td>'."\n";
|
|
||||||
print '<td>';
|
|
||||||
$i = 0;
|
|
||||||
$pdf = pdf_getInstance('A4');
|
|
||||||
if (class_exists('FPDF') && !class_exists('TCPDF'))
|
|
||||||
{
|
|
||||||
if ($i) print ' + ';
|
|
||||||
print 'FPDF';
|
|
||||||
print ' ('.@constant('FPDF_PATH').')';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
if (class_exists('TCPDF'))
|
|
||||||
{
|
|
||||||
if ($i) print ' + ';
|
|
||||||
print 'TCPDF';
|
|
||||||
print ' ('.@constant('TCPDF_PATH').')';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
if (class_exists('FPDI'))
|
|
||||||
{
|
|
||||||
if ($i) print ' + ';
|
|
||||||
print 'FPDI';
|
|
||||||
print ' ('.@constant('FPDI_PATH').')';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
if (class_exists('TCPDI'))
|
|
||||||
{
|
|
||||||
if ($i) print ' + ';
|
|
||||||
print 'TCPDI';
|
|
||||||
print ' ('.@constant('TCPDI_PATH').')';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print '</td>'."\n";
|
|
||||||
print '</tr>'."\n";
|
|
||||||
|
|
||||||
print "</table>\n";
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -116,7 +116,7 @@ $db->commit();
|
|||||||
|
|
||||||
$head = security_prepare_head();
|
$head = security_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'default', $langs->trans("Security"), -1);
|
dol_fiche_head($head, 'default', '', -1);
|
||||||
|
|
||||||
|
|
||||||
// Show warning about external users
|
// Show warning about external users
|
||||||
|
|||||||
@ -94,7 +94,7 @@ print '<input type="hidden" name="action" value="set_proxy">';
|
|||||||
|
|
||||||
$head = security_prepare_head();
|
$head = security_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'proxy', $langs->trans("Security"), -1);
|
dol_fiche_head($head, 'proxy', '', -1);
|
||||||
|
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
|
|||||||
@ -65,13 +65,13 @@ if (!function_exists('gzdecode')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'addprinter' && $user->admin) {
|
if ($action == 'addprinter' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($printername)) {
|
if (empty($printername)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
||||||
@ -82,6 +82,7 @@ if ($action == 'addprinter' && $user->admin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -99,13 +100,13 @@ if ($action == 'addprinter' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'deleteprinter' && $user->admin) {
|
if ($action == 'deleteprinter' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($printerid)) {
|
if (empty($printerid)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->deletePrinter($printerid);
|
$result = $printer->deletePrinter($printerid);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -123,13 +124,13 @@ if ($action == 'deleteprinter' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'updateprinter' && $user->admin) {
|
if ($action == 'updateprinter' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($printerid)) {
|
if (empty($printerid)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -189,13 +190,13 @@ if ($action == 'testtemplate' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'updatetemplate' && $user->admin) {
|
if ($action == 'updatetemplate' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($templateid)) {
|
if (empty($templateid)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -212,13 +213,13 @@ if ($action == 'updatetemplate' && $user->admin) {
|
|||||||
|
|
||||||
if ($action == 'addtemplate' && $user->admin) {
|
if ($action == 'addtemplate' && $user->admin) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
|
||||||
if (empty($templatename)) {
|
if (empty($templatename)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
$result = $printer->addTemplate($templatename, $template);
|
$result = $printer->addTemplate($templatename, $template);
|
||||||
if ($result > 0) $error++;
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
@ -233,6 +234,29 @@ if ($action == 'addtemplate' && $user->admin) {
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'deletetemplate' && $user->admin) {
|
||||||
|
$error = 0;
|
||||||
|
if (empty($templateid)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
|
$result = $printer->deleteTemplate($templateid);
|
||||||
|
if ($result > 0) $error++;
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$db->commit();
|
||||||
|
setEventMessages($langs->trans("TemplateDeleted", $templatename), null);
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -247,6 +271,7 @@ print load_fiche_titre($langs->trans("ReceiptPrinterSetup"), $linkback, 'title_s
|
|||||||
|
|
||||||
$head = receiptprinteradmin_prepare_head($mode);
|
$head = receiptprinteradmin_prepare_head($mode);
|
||||||
|
|
||||||
|
// mode = config
|
||||||
if ($mode == 'config' && $user->admin) {
|
if ($mode == 'config' && $user->admin) {
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
@ -259,7 +284,7 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
|
|
||||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||||
|
|
||||||
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
|
||||||
|
|
||||||
print '<table class="noborder centpercent">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -272,6 +297,22 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
$ret = $printer->listprinters();
|
$ret = $printer->listprinters();
|
||||||
$nbofprinters = count($printer->listprinters);
|
$nbofprinters = count($printer->listprinters);
|
||||||
|
|
||||||
|
if ($action != 'editprinter') {
|
||||||
|
print '<tr>';
|
||||||
|
print '<td><input size="50" type="text" name="printername"></td>';
|
||||||
|
$ret = $printer->selectTypePrinter();
|
||||||
|
print '<td>'.$printer->resprint.'</td>';
|
||||||
|
$ret = $printer->selectProfilePrinter();
|
||||||
|
print '<td>'.$printer->profileresprint.'</td>';
|
||||||
|
print '<td><input size="60" type="text" name="parameter"></td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
if ($action != 'editprinter') {
|
||||||
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -285,7 +326,9 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
||||||
print '<td>'.$printer->profileresprint.'</td>';
|
print '<td>'.$printer->profileresprint.'</td>';
|
||||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||||
print '<td></td>';
|
print '<td>';
|
||||||
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||||
@ -293,15 +336,15 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
||||||
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
||||||
// edit icon
|
// edit icon
|
||||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||||
print img_picto($langs->trans("Edit"), 'edit');
|
print img_picto($langs->trans("Edit"), 'edit');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// delete icon
|
// delete icon
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("Delete"), 'delete');
|
print img_picto($langs->trans("Delete"), 'delete');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// test icon
|
// test icon
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -309,38 +352,10 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action != 'editprinter') {
|
|
||||||
if ($nbofprinters > 0) {
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<th>'.$langs->trans("Name").'</th>';
|
|
||||||
print '<th>'.$langs->trans("Type").'</th>';
|
|
||||||
print '<th>'.$langs->trans("Profile").'</th>';
|
|
||||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
|
||||||
print '<th></th>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
print '<td><input size="50" type="text" name="printername"></td>';
|
|
||||||
$ret = $printer->selectTypePrinter();
|
|
||||||
print '<td>'.$printer->resprint.'</td>';
|
|
||||||
$ret = $printer->selectProfilePrinter();
|
|
||||||
print '<td>'.$printer->profileresprint.'</td>';
|
|
||||||
print '<td><input size="60" type="text" name="parameter"></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
if ($action != 'editprinter') {
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
|
||||||
} else {
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
|
||||||
}
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -370,7 +385,10 @@ if ($mode == 'config' && $user->admin) {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mode = template
|
||||||
if ($mode == 'template' && $user->admin) {
|
if ($mode == 'template' && $user->admin) {
|
||||||
|
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
if ($action != 'edittemplate') {
|
if ($action != 'edittemplate') {
|
||||||
@ -379,16 +397,11 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
print '<input type="hidden" name="action" value="updatetemplate">';
|
print '<input type="hidden" name="action" value="updatetemplate">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '')."<br><br>\n";
|
|
||||||
|
|
||||||
print '<table class="noborder centpercent">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Name").'</th>';
|
print '<th>'.$langs->trans("Name").'</th>';
|
||||||
print '<th>'.$langs->trans("Template").'</th>';
|
print '<th>'.$langs->trans("Template").'</th>';
|
||||||
print '<th></th>';
|
print '<th></th>';
|
||||||
print '<th></th>';
|
|
||||||
print '<th></th>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$ret = $printer->listPrintersTemplates();
|
$ret = $printer->listPrintersTemplates();
|
||||||
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
||||||
@ -401,22 +414,23 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
||||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||||
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
print '<td>';
|
||||||
|
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||||
// edit icon
|
// edit icon
|
||||||
print '<td><a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||||
print img_picto($langs->trans("Edit"), 'edit');
|
print img_picto($langs->trans("Edit"), 'edit');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// delete icon
|
// delete icon
|
||||||
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("Delete"), 'delete');
|
print img_picto($langs->trans("Delete"), 'delete');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
// test icon
|
// test icon
|
||||||
print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
}
|
}
|
||||||
@ -424,20 +438,30 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
if ($action != 'edittemplate') {
|
if ($action != 'edittemplate') {
|
||||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
print '<tr>';
|
||||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||||
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
print '<td>';
|
||||||
|
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
|
||||||
|
print GETPOSTISSET('template') ? GETPOST('template', 'alpha') : $printer->listprinterstemplates[$line]['template'];
|
||||||
|
print '</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
if ($action != 'edittemplate') {
|
||||||
|
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||||
} else {
|
} else {
|
||||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||||
}
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<table class="noborder centpercent">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
|
|||||||
@ -28,7 +28,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
|
||||||
if (!empty($conf->resouce->enabled)) require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin", "resource"));
|
$langs->loadLangs(array("admin", "resource"));
|
||||||
|
|||||||
@ -197,7 +197,7 @@ print "<br>\n";
|
|||||||
|
|
||||||
$head = security_prepare_head();
|
$head = security_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'passwords', $langs->trans("Security"), -1);
|
dol_fiche_head($head, 'passwords', '', -1);
|
||||||
|
|
||||||
|
|
||||||
// Choix du gestionnaire du generateur de mot de passe
|
// Choix du gestionnaire du generateur de mot de passe
|
||||||
|
|||||||
@ -100,7 +100,7 @@ print '<input type="hidden" name="action" value="updateform">';
|
|||||||
|
|
||||||
$head = security_prepare_head();
|
$head = security_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'file', $langs->trans("Security"), -1);
|
dol_fiche_head($head, 'file', '', -1);
|
||||||
|
|
||||||
|
|
||||||
// Upload options
|
// Upload options
|
||||||
|
|||||||
@ -93,7 +93,7 @@ print '<input type="hidden" name="action" value="updateform">';
|
|||||||
|
|
||||||
$head = security_prepare_head();
|
$head = security_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'misc', $langs->trans("Security"), -1);
|
dol_fiche_head($head, 'misc', '', -1);
|
||||||
|
|
||||||
|
|
||||||
// Other Options
|
// Other Options
|
||||||
|
|||||||
@ -28,8 +28,9 @@ require '../../main.inc.php';
|
|||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|
||||||
if (!$user->admin)
|
if (!$user->admin) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
@ -44,6 +45,11 @@ if ($action == 'convertutf8')
|
|||||||
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
|
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
|
if ($action == 'convertdynamic')
|
||||||
|
{
|
||||||
|
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -112,13 +118,17 @@ if (!$base)
|
|||||||
|
|
||||||
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
|
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
|
||||||
print '<td>'.$obj->Engine.'</td>';
|
print '<td>'.$obj->Engine.'</td>';
|
||||||
if (isset($obj->Engine) && $obj->Engine == "MyISAM")
|
if (isset($obj->Engine) && $obj->Engine == "MyISAM") {
|
||||||
{
|
print '<td><a class="reposition" href="database-tables.php?action=convert&table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDb</a></td>';
|
||||||
print '<td><a class="reposition" href="database-tables.php?action=convert&table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDB</a></td>';
|
|
||||||
} else {
|
} else {
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
}
|
}
|
||||||
print '<td>'.$obj->Row_format.'</td>';
|
print '<td>';
|
||||||
|
print $obj->Row_format;
|
||||||
|
if (isset($obj->Row_format) && (in_array($obj->Row_format, array("Compact")))) {
|
||||||
|
print '<br><a class="reposition" href="database-tables.php?action=convertdynamic&table='.$obj->Name.'">'.$langs->trans("Convert").' Dynamic</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
print '<td align="right">'.$obj->Rows.'</td>';
|
print '<td align="right">'.$obj->Rows.'</td>';
|
||||||
print '<td align="right">'.$obj->Avg_row_length.'</td>';
|
print '<td align="right">'.$obj->Avg_row_length.'</td>';
|
||||||
print '<td align="right">'.$obj->Data_length.'</td>';
|
print '<td align="right">'.$obj->Data_length.'</td>';
|
||||||
@ -127,8 +137,7 @@ if (!$base)
|
|||||||
print '<td align="right">'.$obj->Auto_increment.'</td>';
|
print '<td align="right">'.$obj->Auto_increment.'</td>';
|
||||||
print '<td align="right">'.$obj->Check_time.'</td>';
|
print '<td align="right">'.$obj->Check_time.'</td>';
|
||||||
print '<td align="right">'.$obj->Collation;
|
print '<td align="right">'.$obj->Collation;
|
||||||
if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci"))))
|
if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) {
|
||||||
{
|
|
||||||
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
|
print '<br><a class="reposition" href="database-tables.php?action=convertutf8&table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -237,7 +237,8 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||||
print '</legend>';
|
print '</legend>';
|
||||||
print '<input type="checkbox" name="drop"'.(((!isset($_GET["drop"]) && !isset($_POST["drop"])) || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
|
||||||
|
print '<input type="checkbox" name="drop"'.((! GETPOSTISSET("drop") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
|
|||||||
@ -40,7 +40,7 @@ $transkey = GETPOST('transkey', 'alphanohtml');
|
|||||||
$transvalue = GETPOST('transvalue', 'none');
|
$transvalue = GETPOST('transvalue', 'none');
|
||||||
|
|
||||||
|
|
||||||
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'overwrite';
|
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'searchkey';
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
@ -496,7 +496,7 @@ if ($mode == 'searchkey')
|
|||||||
if ($i > ($offset + $limit)) break;
|
if ($i > ($offset + $limit)) break;
|
||||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||||
print dol_escape_htmltag($val);
|
print dol_escape_htmltag($val);
|
||||||
print '</td><td class="right">';
|
print '</td><td class="right nowraponall">';
|
||||||
if (!empty($newlangfileonly->tab_translate[$key]))
|
if (!empty($newlangfileonly->tab_translate[$key]))
|
||||||
{
|
{
|
||||||
if ($val != $newlangfileonly->tab_translate[$key])
|
if ($val != $newlangfileonly->tab_translate[$key])
|
||||||
@ -516,7 +516,7 @@ if ($mode == 'searchkey')
|
|||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete">'.img_delete().'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete">'.img_delete().'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
|
||||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||||
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||||
{
|
{
|
||||||
@ -530,7 +530,7 @@ if ($mode == 'searchkey')
|
|||||||
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||||
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
|
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
|
||||||
|
|
||||||
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto('FixOnTransifex', 'globe').'</a>';
|
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto($langs->trans('FixOnTransifex'), 'globe').'</a>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||||
|
|||||||
@ -419,8 +419,10 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
$object = new Product($this->db);
|
$object = new Product($this->db);
|
||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
if (!$result) {
|
if ($result==0) {
|
||||||
throw new RestException(404, 'Product not found');
|
throw new RestException(404, 'Product not found');
|
||||||
|
} elseif ($result<0) {
|
||||||
|
throw new RestException(500, 'Error while fetching object: '.$object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||||
@ -630,7 +632,7 @@ class Documents extends DolibarrApi
|
|||||||
}
|
}
|
||||||
elseif ($result < 0)
|
elseif ($result < 0)
|
||||||
{
|
{
|
||||||
throw new RestException(500, 'Error while fetching object.');
|
throw new RestException(500, 'Error while fetching object: '.$object->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -251,15 +251,17 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
|||||||
if ($tmpmodule != 'api')
|
if ($tmpmodule != 'api')
|
||||||
$tmpmodule = preg_replace('/api$/i', '', $tmpmodule);
|
$tmpmodule = preg_replace('/api$/i', '', $tmpmodule);
|
||||||
$classfile = str_replace('_', '', $tmpmodule);
|
$classfile = str_replace('_', '', $tmpmodule);
|
||||||
if ($module == 'supplierproposals')
|
|
||||||
|
// Special cases that does not match name rules conventions
|
||||||
|
if ($moduleobject == 'supplierproposals')
|
||||||
$classfile = 'supplier_proposals';
|
$classfile = 'supplier_proposals';
|
||||||
if ($module == 'supplierorders')
|
if ($moduleobject == 'supplierorders')
|
||||||
$classfile = 'supplier_orders';
|
$classfile = 'supplier_orders';
|
||||||
if ($module == 'supplierinvoices')
|
if ($moduleobject == 'supplierinvoices')
|
||||||
$classfile = 'supplier_invoices';
|
$classfile = 'supplier_invoices';
|
||||||
if ($module == 'ficheinter')
|
if ($moduleobject == 'ficheinter')
|
||||||
$classfile = 'interventions';
|
$classfile = 'interventions';
|
||||||
if ($module == 'interventions')
|
if ($moduleobject == 'interventions')
|
||||||
$classfile = 'interventions';
|
$classfile = 'interventions';
|
||||||
|
|
||||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
|
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
|
||||||
|
|||||||
@ -57,9 +57,11 @@ $thirdpartytmp = new Societe($db);
|
|||||||
if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||||
{
|
{
|
||||||
$action = ''; // We reset because we don't want to build doc
|
$action = ''; // We reset because we don't want to build doc
|
||||||
if (GETPOST('productid') > 0)
|
if (GETPOST('productid') > 0) {
|
||||||
{
|
$result = $producttmp->fetch(GETPOST('productid'));
|
||||||
$producttmp->fetch(GETPOST('productid'));
|
if ($result < 0) {
|
||||||
|
setEventMessage($producttmp->error, 'errors');
|
||||||
|
}
|
||||||
$forbarcode = $producttmp->barcode;
|
$forbarcode = $producttmp->barcode;
|
||||||
$fk_barcode_type = $producttmp->barcode_type;
|
$fk_barcode_type = $producttmp->barcode_type;
|
||||||
|
|
||||||
|
|||||||
@ -130,7 +130,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
// Object card
|
// Object card
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
$linkback = '<a href="'.dol_buildpath('/bom/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.dol_buildpath('/bom/bom_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -192,10 +192,10 @@ if (empty($reshook))
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Set if we used free entry or predefined product
|
// Set if we used free entry or predefined product
|
||||||
$qty = GETPOST('qty', 'int');
|
$qty = price2num(GETPOST('qty', 'int'));
|
||||||
$qty_frozen = GETPOST('qty_frozen', 'int');
|
$qty_frozen = GETPOST('qty_frozen', 'int');
|
||||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||||
$efficiency = GETPOST('efficiency', 'int');
|
$efficiency = price2num(GETPOST('efficiency', 'int'));
|
||||||
|
|
||||||
if ($qty == '') {
|
if ($qty == '') {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||||
@ -219,6 +219,8 @@ if (empty($reshook))
|
|||||||
unset($_POST['qty']);
|
unset($_POST['qty']);
|
||||||
unset($_POST['qty_frozen']);
|
unset($_POST['qty_frozen']);
|
||||||
unset($_POST['disable_stock_change']);
|
unset($_POST['disable_stock_change']);
|
||||||
|
|
||||||
|
$object->fetchLines();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -541,7 +543,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
if (!empty($object->table_element_line))
|
if (!empty($object->table_element_line))
|
||||||
{
|
{
|
||||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
|
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '').'" method="POST">
|
||||||
<input type="hidden" name="token" value="' . newToken().'">
|
<input type="hidden" name="token" value="' . newToken().'">
|
||||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||||
<input type="hidden" name="mode" value="">
|
<input type="hidden" name="mode" value="">
|
||||||
|
|||||||
@ -929,6 +929,7 @@ class BOM extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load("mrp");
|
$langs->load("mrp");
|
||||||
|
$outputlangs->load("products");
|
||||||
|
|
||||||
if (!dol_strlen($modele)) {
|
if (!dol_strlen($modele)) {
|
||||||
$modele = 'standard';
|
$modele = 'standard';
|
||||||
@ -1004,7 +1005,11 @@ class BOM extends CommonObject
|
|||||||
|
|
||||||
foreach ($this->lines as &$line) {
|
foreach ($this->lines as &$line) {
|
||||||
$tmpproduct = new Product($this->db);
|
$tmpproduct = new Product($this->db);
|
||||||
$tmpproduct->fetch($line->fk_product);
|
$result= $tmpproduct->fetch($line->fk_product);
|
||||||
|
if ($result < 0) {
|
||||||
|
$this->error=$tmpproduct->error;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||||
if (empty($line->unit_cost)) {
|
if (empty($line->unit_cost)) {
|
||||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)
|
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)
|
||||||
|
|||||||
@ -52,8 +52,15 @@ foreach ($linkedObjectBlock as $key => $objectlink)
|
|||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
|
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
|
||||||
$product_static->fetch($objectlink->fk_product);
|
|
||||||
echo '<td class="linkedcol-ref" align="center">'.$product_static->getNomUrl(1).'</td>';
|
echo '<td class="linkedcol-ref" align="center">';
|
||||||
|
$result=$product_static->fetch($objectlink->fk_product);
|
||||||
|
if ($result<0) {
|
||||||
|
setEventMessage($product_static->error, 'errors');
|
||||||
|
} elseif ($result>0) {
|
||||||
|
$product_static->getNomUrl(1);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
|
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
|
||||||
echo '<td class="linkedcol-amount right">';
|
echo '<td class="linkedcol-amount right">';
|
||||||
if ($user->rights->commande->lire) {
|
if ($user->rights->commande->lire) {
|
||||||
|
|||||||
@ -113,7 +113,7 @@ if ($conf->global->PRODUCT_USE_UNITS)
|
|||||||
{
|
{
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
print '<td class="nobottom linecoluseunit left">';
|
print '<td class="nobottom linecoluseunit left">';
|
||||||
print $form->selectUnits($line->fk_unit, "units");
|
print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -145,6 +145,7 @@ if ($action == 'create')
|
|||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewBookmark"));
|
print load_fiche_titre($langs->trans("NewBookmark"));
|
||||||
|
|
||||||
|
|||||||
@ -154,7 +154,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
$newcardbutton = '';
|
$newcardbutton = '';
|
||||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
|
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
|
|||||||
@ -1213,7 +1213,8 @@ class Categorie extends CommonObject
|
|||||||
//print 'Result for id_categ='.$id_categ.' : '.$this->cats[$id_categ]['fullpath'].'<br>'."\n";
|
//print 'Result for id_categ='.$id_categ.' : '.$this->cats[$id_categ]['fullpath'].'<br>'."\n";
|
||||||
|
|
||||||
// We count number of _ to have level
|
// We count number of _ to have level
|
||||||
$this->cats[$id_categ]['level'] = dol_strlen(preg_replace('/[^_]/i', '', $this->cats[$id_categ]['fullpath']));
|
$nbunderscore = substr_count($this->cats[$id_categ]['fullpath'], '_');
|
||||||
|
$this->cats[$id_categ]['level'] = ($nbunderscore ? $nbunderscore : null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2009,4 +2010,25 @@ class Categorie extends CommonObject
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count all categories
|
||||||
|
*
|
||||||
|
* @return int Number of categories, -1 on error
|
||||||
|
*/
|
||||||
|
public function countNbOfCategories()
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::count_all_categories", LOG_DEBUG);
|
||||||
|
$sql = "SELECT COUNT(rowid) FROM ".MAIN_DB_PREFIX."categorie";
|
||||||
|
$sql .= " WHERE entity IN (".getEntity('category').")";
|
||||||
|
|
||||||
|
$res = $this->db->query($sql);
|
||||||
|
if ($res) {
|
||||||
|
$obj = $this->db->fetch_object($res);
|
||||||
|
return $obj->count;
|
||||||
|
} else {
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1077,6 +1077,7 @@ if ($action == 'create')
|
|||||||
print '<input type="hidden" name="origin" size="10" value="'.GETPOST('origin').'">';
|
print '<input type="hidden" name="origin" size="10" value="'.GETPOST('origin').'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$reg = array();
|
||||||
if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg))
|
if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/', GETPOST("datep"), $reg))
|
||||||
{
|
{
|
||||||
$object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]);
|
$object->datep = dol_mktime(0, 0, 0, $reg[2], $reg[3], $reg[1]);
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -526,6 +527,7 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
// Prospection level and status
|
||||||
if ($object->client == 2 || $object->client == 3)
|
if ($object->client == 2 || $object->client == 3)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -533,12 +535,12 @@ if ($object->id > 0)
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border centpercent tableforfield">';
|
print '<table class="border centpercent tableforfield">';
|
||||||
|
|
||||||
// Level of prospect
|
// Level of prospection
|
||||||
print '<tr><td class="titlefield nowrap">';
|
print '<tr><td class="titlefield nowrap">';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||||
print $langs->trans('ProspectLevel');
|
print $langs->trans('ProspectLevel');
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editlevel')
|
if ($action == 'editlevel')
|
||||||
@ -550,7 +552,7 @@ if ($object->id > 0)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Status
|
// Status of prospection
|
||||||
$object->loadCacheOfProspStatus();
|
$object->loadCacheOfProspStatus();
|
||||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -559,7 +561,7 @@ if ($object->id > 0)
|
|||||||
{
|
{
|
||||||
$titlealt = 'default';
|
$titlealt = 'default';
|
||||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>';
|
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
|
||||||
}
|
}
|
||||||
print '</div></td></tr>';
|
print '</div></td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
@ -1127,7 +1129,7 @@ if ($object->id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Last invoices
|
* Latest invoices
|
||||||
*/
|
*/
|
||||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -230,6 +230,7 @@ if (empty($reshook))
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
if ($ret > 0) $object->fetch_thirdparty();
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,6 +768,7 @@ if (empty($reshook))
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
if ($ret > 0) $object->fetch_thirdparty();
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
||||||
@ -790,7 +792,7 @@ if (empty($reshook))
|
|||||||
} elseif ($action == 'addline' && $usercancreate) { // Add line
|
} elseif ($action == 'addline' && $usercancreate) { // Add line
|
||||||
// Set if we used free entry or predefined product
|
// Set if we used free entry or predefined product
|
||||||
$predef = '';
|
$predef = '';
|
||||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
$product_desc = (GETPOST('dp_desc', 'none') ?GETPOST('dp_desc', 'none') : '');
|
||||||
$price_ht = GETPOST('price_ht');
|
$price_ht = GETPOST('price_ht');
|
||||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||||
@ -1240,6 +1242,7 @@ if (empty($reshook))
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
if ($ret > 0) $object->fetch_thirdparty();
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3664,6 +3664,7 @@ class Propal extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load("propale");
|
$langs->load("propale");
|
||||||
|
$outputlangs->load("products");
|
||||||
|
|
||||||
if (!dol_strlen($modele)) {
|
if (!dol_strlen($modele)) {
|
||||||
$modele = 'azur';
|
$modele = 'azur';
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -71,7 +72,7 @@ if (!empty($conf->propal->enabled))
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT count(*) as cc, st.libelle, st.id";
|
$sql = "SELECT count(*) as cc, st.libelle, st.picto, st.id";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
|
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -98,7 +99,7 @@ if ($resql)
|
|||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<a href="prospects.php?page=0&stcomm='.$obj->id.'">';
|
print '<a href="prospects.php?page=0&stcomm='.$obj->id.'">';
|
||||||
print img_action($langs->trans("Show"), $obj->id).' ';
|
print img_action($langs->trans("Show"), $obj->id, $obj->picto).' ';
|
||||||
print $langs->trans("StatusProspect".$obj->id);
|
print $langs->trans("StatusProspect".$obj->id);
|
||||||
print '</a></td><td class="right">'.$obj->cc.'</td></tr>';
|
print '</a></td><td class="right">'.$obj->cc.'</td></tr>';
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -1580,7 +1580,7 @@ if ($action == 'create' && $usercancreate)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||||
// reload page to retrieve customer informations
|
// reload page to retrieve customer informations
|
||||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||||
{
|
{
|
||||||
@ -2003,7 +2003,7 @@ if ($action == 'create' && $usercancreate)
|
|||||||
if ($action == 'clone') {
|
if ($action == 'clone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)'))
|
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)'))
|
||||||
);
|
);
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3859,6 +3859,7 @@ class Commande extends CommonOrder
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
|
$outputlangs->load("products");
|
||||||
|
|
||||||
if (!dol_strlen($modele)) {
|
if (!dol_strlen($modele)) {
|
||||||
$modele = 'einstein';
|
$modele = 'einstein';
|
||||||
|
|||||||
@ -116,7 +116,7 @@ $hookmanager->initHooks(array('orderlist'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label('commande');
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
|
|||||||
@ -469,7 +469,7 @@ class Account extends CommonObject
|
|||||||
* Add an entry into table ".MAIN_DB_PREFIX."bank
|
* Add an entry into table ".MAIN_DB_PREFIX."bank
|
||||||
*
|
*
|
||||||
* @param int $date Date operation
|
* @param int $date Date operation
|
||||||
* @param string $oper 1,2,3,4... (deprecated) or 'TYP','VIR','PRE','LIQ','VAD','CB','CHQ'...
|
* @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'...
|
||||||
* @param string $label Descripton
|
* @param string $label Descripton
|
||||||
* @param float $amount Amount
|
* @param float $amount Amount
|
||||||
* @param string $num_chq Numero cheque ou virement
|
* @param string $num_chq Numero cheque ou virement
|
||||||
|
|||||||
@ -423,7 +423,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
@ -2415,7 +2415,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param string $force_number Reference to force on invoice
|
* @param string $force_number Reference to force on invoice
|
||||||
* @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease)
|
* @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease)
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @param int $batch_rule [=0] 0 not decrement batch, else batch rule to use
|
* @param int $batch_rule 0=do not decrement batch, else batch rule to use
|
||||||
* 1=take in batches ordered by sellby and eatby dates
|
* 1=take in batches ordered by sellby and eatby dates
|
||||||
* @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK
|
* @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK
|
||||||
*/
|
*/
|
||||||
@ -4296,6 +4296,7 @@ class Facture extends CommonInvoice
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
$outputlangs->load("products");
|
||||||
|
|
||||||
if (!dol_strlen($modele))
|
if (!dol_strlen($modele))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,6 +53,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inv
|
|||||||
|
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
|
$socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
@ -106,7 +108,7 @@ $hookmanager->initHooks(array('invoicereclist'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label('facture_rec');
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
@ -151,6 +153,11 @@ if ($socid > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($socid > 0) {
|
||||||
|
$tmpthirdparty = new Societe($db);
|
||||||
|
$res = $tmpthirdparty->fetch($socid);
|
||||||
|
if ($res > 0) $search_societe = $tmpthirdparty->name;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
@ -150,7 +150,7 @@ $hookmanager->initHooks(array('invoicelist'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label('facture');
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
@ -545,6 +545,8 @@ if (!$sall)
|
|||||||
$sql .= ' f.paye, f.fk_statut, f.close_code,';
|
$sql .= ' f.paye, f.fk_statut, f.close_code,';
|
||||||
$sql .= ' f.datec, f.tms, f.date_closing,';
|
$sql .= ' f.datec, f.tms, f.date_closing,';
|
||||||
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
|
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
|
||||||
|
$sql .= ' f.fk_user_author, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva,';
|
||||||
|
$sql .= ' f.multicurrency_total_tva, f.multicurrency_total_ttc,';
|
||||||
$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
||||||
$sql .= ' typent.code,';
|
$sql .= ' typent.code,';
|
||||||
$sql .= ' state.code_departement, state.nom,';
|
$sql .= ' state.code_departement, state.nom,';
|
||||||
@ -830,12 +832,15 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
|
/*
|
||||||
print $langs->trans('From').' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to').' ';
|
print $langs->trans('to').' ';*/
|
||||||
|
print $langs->trans("Before").' ';
|
||||||
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
|
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
|
||||||
|
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -1442,7 +1447,7 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$userstatic->id = $obj->fk_user_author;
|
$userstatic->id = $obj->fk_user_author;
|
||||||
$userstatic->login = $obj->login;
|
$userstatic->login = $obj->login;
|
||||||
print '<td align="center">';
|
print '<td class="center tdoverflowmax100">';
|
||||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|||||||
@ -38,8 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
if (!$user->rights->facture->lire) accessforbidden();
|
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('bills', 'banks', 'withdrawals', 'companies'));
|
$langs->loadLangs(array('bills', 'banks', 'withdrawals', 'companies'));
|
||||||
|
|
||||||
@ -51,7 +49,6 @@ $type = GETPOST('type', 'aZ09');
|
|||||||
|
|
||||||
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
||||||
if ($user->socid) $socid = $user->socid;
|
if ($user->socid) $socid = $user->socid;
|
||||||
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
|
|
||||||
|
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
$object = new FactureFournisseur($db);
|
$object = new FactureFournisseur($db);
|
||||||
@ -63,6 +60,7 @@ if ($type == 'bank-transfer') {
|
|||||||
if ($id > 0 || !empty($ref))
|
if ($id > 0 || !empty($ref))
|
||||||
{
|
{
|
||||||
$ret = $object->fetch($id, $ref);
|
$ret = $object->fetch($id, $ref);
|
||||||
|
$isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
@ -71,6 +69,13 @@ if ($id > 0 || !empty($ref))
|
|||||||
|
|
||||||
$hookmanager->initHooks(array('directdebitcard', 'globalcard'));
|
$hookmanager->initHooks(array('directdebitcard', 'globalcard'));
|
||||||
|
|
||||||
|
if ($type == 'bank-transfer') {
|
||||||
|
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', $fieldid, $isdraft);
|
||||||
|
if (!$user->rights->fournisseur->facture->lire) accessforbidden();
|
||||||
|
} else {
|
||||||
|
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
|
||||||
|
if (!$user->rights->facture->lire) accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2015-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2015-2020 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||||
@ -161,6 +161,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
|||||||
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
|
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
|
$sql.= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, ";
|
||||||
|
$sql.= "s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
|
||||||
|
|
||||||
|
// Add Group from hooks
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters);
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -458,7 +466,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
|||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye,";
|
$sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye,";
|
||||||
$sql .= " s.nom, s.rowid, s.code_fournisseur, s.code_compta_fournisseur";
|
$sql .= " s.nom, s.rowid, s.code_fournisseur, s.code_compta_fournisseur, s.email";
|
||||||
$sql .= " ORDER BY ff.tms DESC ";
|
$sql .= " ORDER BY ff.tms DESC ";
|
||||||
$sql .= $db->plimit($max, 0);
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
|||||||
@ -1154,7 +1154,7 @@ class Paiement extends CommonObject
|
|||||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
$label = '<u>'.$langs->trans("ShowPayment").'</u><br>';
|
$label = '<u>'.$langs->trans("Payment").'</u><br>';
|
||||||
$label .= '<strong>'.$langs->trans("Ref").':</strong> '.$this->ref;
|
$label .= '<strong>'.$langs->trans("Ref").':</strong> '.$this->ref;
|
||||||
if ($this->datepaye ? $this->datepaye : $this->date) $label .= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
if ($this->datepaye ? $this->datepaye : $this->date) $label .= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
||||||
if ($mode == 'withlistofinvoices')
|
if ($mode == 'withlistofinvoices')
|
||||||
|
|||||||
@ -68,7 +68,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|||||||
|
|
||||||
|
|
||||||
$thirdpartystatic = new Societe($db);
|
$thirdpartystatic = new Societe($db);
|
||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
$bprev = new BonPrelevement($db);
|
$bprev = new BonPrelevement($db);
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
@ -94,7 +94,7 @@ print '</td></tr></table></div><br>';
|
|||||||
*/
|
*/
|
||||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||||
$sql .= " pfd.date_demande, pfd.amount,";
|
$sql .= " pfd.date_demande, pfd.amount,";
|
||||||
$sql .= " s.nom as name, s.email, s.rowid as socid";
|
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -138,13 +138,14 @@ if ($resql)
|
|||||||
$thirdpartystatic->id = $obj->socid;
|
$thirdpartystatic->id = $obj->socid;
|
||||||
$thirdpartystatic->name = $obj->name;
|
$thirdpartystatic->name = $obj->name;
|
||||||
$thirdpartystatic->email = $obj->email;
|
$thirdpartystatic->email = $obj->email;
|
||||||
|
$thirdpartystatic->tva_intra = $obj->tva_intra;
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $thirdpartystatic->getNomUrl(1, 'customer');
|
print $thirdpartystatic->getNomUrl(1, 'supplier');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|||||||
@ -31,10 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.p
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('banks', 'categories', 'bills', 'withdrawals'));
|
$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals'));
|
||||||
|
|
||||||
if (!$user->rights->prelevement->bons->lire)
|
|
||||||
accessforbidden();
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->socid > 0) accessforbidden();
|
if ($user->socid > 0) accessforbidden();
|
||||||
@ -44,7 +41,6 @@ $action = GETPOST('action', 'alpha');
|
|||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
$type = GETPOST('type', 'aZ09');
|
$type = GETPOST('type', 'aZ09');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -67,6 +63,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
|||||||
|
|
||||||
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
|
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
|
||||||
|
|
||||||
|
if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -83,7 +86,11 @@ if (empty($reshook))
|
|||||||
$res = $object->delete($user);
|
$res = $object->delete($user);
|
||||||
if ($res > 0)
|
if ($res > 0)
|
||||||
{
|
{
|
||||||
header("Location: index.php");
|
if ($object->type == 'bank-transfer') {
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php');
|
||||||
|
} else {
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/index.php');
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,11 +146,9 @@ if (empty($reshook))
|
|||||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||||
|
|
||||||
$error = $object->set_infocredit($user, $dt);
|
$error = $object->set_infocredit($user, $dt);
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
header("Location: card.php?id=".$id."&error=$error");
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +179,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php'.($object->type != 'bank-transfer' ? '' : '?type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||||
|
|
||||||
@ -200,7 +205,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -223,7 +228,9 @@ if ($id > 0 || $ref)
|
|||||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("BankToReceiveWithdraw");
|
$labelofbankfield = "BankToReceiveWithdraw";
|
||||||
|
if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer';
|
||||||
|
print $langs->trans($labelofbankfield);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($acc->id > 0)
|
if ($acc->id > 0)
|
||||||
@ -232,9 +239,13 @@ if ($id > 0 || $ref)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
$labelfororderfield = 'WithdrawalFile';
|
||||||
|
if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile';
|
||||||
|
print $langs->trans($labelfororderfield).'</td><td>';
|
||||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
$modulepart = 'prelevement';
|
||||||
|
if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer';
|
||||||
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -67,6 +68,9 @@ class BonPrelevement extends CommonObject
|
|||||||
public $emetteur_bic;
|
public $emetteur_bic;
|
||||||
public $emetteur_ics;
|
public $emetteur_ics;
|
||||||
|
|
||||||
|
public $date_trans;
|
||||||
|
public $user_trans;
|
||||||
|
|
||||||
public $total;
|
public $total;
|
||||||
public $fetched;
|
public $fetched;
|
||||||
public $statut; // 0-Wait, 1-Trans, 2-Done
|
public $statut; // 0-Wait, 1-Trans, 2-Done
|
||||||
@ -283,6 +287,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= ", p.method_trans, p.fk_user_trans";
|
$sql .= ", p.method_trans, p.fk_user_trans";
|
||||||
$sql .= ", p.date_credit as date_credit";
|
$sql .= ", p.date_credit as date_credit";
|
||||||
$sql .= ", p.fk_user_credit";
|
$sql .= ", p.fk_user_credit";
|
||||||
|
$sql .= ", p.type";
|
||||||
$sql .= ", p.statut as status";
|
$sql .= ", p.statut as status";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
|
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
|
||||||
@ -310,6 +315,8 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->date_credit = $this->db->jdate($obj->date_credit);
|
$this->date_credit = $this->db->jdate($obj->date_credit);
|
||||||
$this->user_credit = $obj->fk_user_credit;
|
$this->user_credit = $obj->fk_user_credit;
|
||||||
|
|
||||||
|
$this->type = $obj->type;
|
||||||
|
|
||||||
$this->status = $obj->status;
|
$this->status = $obj->status;
|
||||||
$this->statut = $obj->status; // For backward compatibility
|
$this->statut = $obj->status; // For backward compatibility
|
||||||
|
|
||||||
@ -402,7 +409,7 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set direct debit order to "credited" status.
|
* Set direct debit or credit transfer order to "paid" status.
|
||||||
*
|
*
|
||||||
* @param User $user Id of user
|
* @param User $user Id of user
|
||||||
* @param int $date date of action
|
* @param int $date date of action
|
||||||
@ -417,10 +424,15 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
if ($this->fetched == 1)
|
if ($this->fetched == 1)
|
||||||
{
|
{
|
||||||
if ($date >= $this->date_trans)
|
if ($date < $this->date_trans)
|
||||||
{
|
|
||||||
if ($this->db->begin())
|
|
||||||
{
|
{
|
||||||
|
$this->error = 'DateOfMovementLowerThanDateOfFileTransmission';
|
||||||
|
dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
|
||||||
|
return -1027;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
|
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
|
||||||
$sql .= " SET fk_user_credit = ".$user->id;
|
$sql .= " SET fk_user_credit = ".$user->id;
|
||||||
$sql .= ", statut = ".self::STATUS_CREDITED;
|
$sql .= ", statut = ".self::STATUS_CREDITED;
|
||||||
@ -429,7 +441,8 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
|
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load('withdrawals');
|
$langs->load('withdrawals');
|
||||||
$subject = $langs->trans("InfoCreditSubject", $this->ref);
|
$subject = $langs->trans("InfoCreditSubject", $this->ref);
|
||||||
@ -447,8 +460,14 @@ class BonPrelevement extends CommonObject
|
|||||||
$num = count($facs);
|
$num = count($facs);
|
||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$fac = new FactureFournisseur($this->db);
|
||||||
|
} else {
|
||||||
$fac = new Facture($this->db);
|
$fac = new Facture($this->db);
|
||||||
$fac->fetch($facs[$i][0]);
|
}
|
||||||
|
|
||||||
|
$result = $fac->fetch($facs[$i][0]);
|
||||||
|
|
||||||
$amounts[$fac->id] = $facs[$i][1];
|
$amounts[$fac->id] = $facs[$i][1];
|
||||||
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
||||||
|
|
||||||
@ -457,33 +476,61 @@ class BonPrelevement extends CommonObject
|
|||||||
$totaldeposits = $fac->getSumDepositsUsed();
|
$totaldeposits = $fac->getSumDepositsUsed();
|
||||||
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
|
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||||
|
|
||||||
|
// @TODO Move this after creation of payment
|
||||||
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
|
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
|
||||||
$result = $fac->set_paid($user);
|
$result = $fac->set_paid($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$this->error = $fac->error;
|
||||||
|
$this->errors = $fac->errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//var_dump($amountsperthirdparty);exit;
|
||||||
|
|
||||||
// Make one payment per customer
|
// Make one payment per customer
|
||||||
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
|
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
|
||||||
{
|
{
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$paiement = new PaiementFourn($this->db);
|
||||||
|
} else {
|
||||||
$paiement = new Paiement($this->db);
|
$paiement = new Paiement($this->db);
|
||||||
|
}
|
||||||
$paiement->datepaye = $date;
|
$paiement->datepaye = $date;
|
||||||
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
||||||
$paiement->paiementid = 3; //
|
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$paiement->paiementid = 2;
|
||||||
|
$paiement->paiementcode = 'VIR';
|
||||||
|
} else {
|
||||||
|
$paiement->paiementid = 3;
|
||||||
|
$paiement->paiementcode = 'PRE';
|
||||||
|
}
|
||||||
|
|
||||||
$paiement->num_payment = $this->ref; // Set ref of direct debit note
|
$paiement->num_payment = $this->ref; // Set ref of direct debit note
|
||||||
$paiement->num_paiement = $this->ref; // For backward compatibility
|
$paiement->num_paiement = $this->ref; // For backward compatibility
|
||||||
$paiement->id_prelevement = $this->id;
|
$paiement->id_prelevement = $this->id;
|
||||||
|
|
||||||
$paiement_id = $paiement->create($user);
|
$paiement_id = $paiement->create($user); // This use ->paiementid, that is ID of payment mode
|
||||||
if ($paiement_id < 0)
|
if ($paiement_id < 0)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
|
|
||||||
$error++;
|
$error++;
|
||||||
|
$this->error = $paiement->error;
|
||||||
|
$this->errors = $paiement->errors;
|
||||||
|
dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
|
||||||
} else {
|
} else {
|
||||||
$result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', '');
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$modeforaddpayment = 'payment_supplier';
|
||||||
|
} else {
|
||||||
|
$modeforaddpayment = 'payment';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $paiement->addPaymentToBank($user, $modeforaddpayment, '(WithdrawalPayment)', $bankaccount, '', '');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
|
|
||||||
$error++;
|
$error++;
|
||||||
|
$this->error = $paiement->error;
|
||||||
|
$this->errors = $paiement->errors;
|
||||||
|
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($paiement->amounts);
|
//var_dump($paiement->amounts);
|
||||||
@ -493,16 +540,18 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
// Update withdrawal line
|
// Update withdrawal line
|
||||||
// TODO: Translate to ligneprelevement.class.php
|
// TODO: Translate to ligneprelevement.class.php
|
||||||
|
if (! $error) {
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||||
$sql .= " SET statut = 2";
|
$sql .= " SET statut = 2";
|
||||||
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
|
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
|
||||||
|
|
||||||
if (!$this->db->query($sql))
|
if (!$this->db->query($sql)) {
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
|
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
|
dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -519,17 +568,8 @@ class BonPrelevement extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dol_syslog("bon-prelevment::set_infocredit ROLLBACK ");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
dol_syslog(get_class($this)."::set_infocredit 1025 Open SQL transaction impossible ");
|
|
||||||
return -1025;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dol_syslog("bon-prelevment::set_infocredit 1027 Date de credit < Date de trans ");
|
|
||||||
return -1027;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return -1026;
|
return -1026;
|
||||||
}
|
}
|
||||||
@ -558,7 +598,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " SET fk_user_trans = ".$user->id;
|
$sql .= " SET fk_user_trans = ".$user->id;
|
||||||
$sql .= " , date_trans = '".$this->db->idate($date)."'";
|
$sql .= " , date_trans = '".$this->db->idate($date)."'";
|
||||||
$sql .= " , method_trans = ".$method;
|
$sql .= " , method_trans = ".$method;
|
||||||
$sql .= " , statut = 1";
|
$sql .= " , statut = ".self::STATUS_TRANSFERED;
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$sql .= " AND statut = 0";
|
$sql .= " AND statut = 0";
|
||||||
@ -580,6 +620,7 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->date_trans = $date;
|
$this->date_trans = $date;
|
||||||
$this->statut = 1;
|
$this->statut = 1;
|
||||||
|
$this->user_trans = $user->id;
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -610,7 +651,12 @@ class BonPrelevement extends CommonObject
|
|||||||
/*
|
/*
|
||||||
* Returns all invoices presented within same order
|
* Returns all invoices presented within same order
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT fk_facture";
|
$sql = "SELECT ";
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$sql .= " pf.fk_facture_fourn";
|
||||||
|
} else {
|
||||||
|
$sql .= " pf.fk_facture";
|
||||||
|
}
|
||||||
if ($amounts) $sql .= ", SUM(pl.amount)";
|
if ($amounts) $sql .= ", SUM(pl.amount)";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
@ -619,7 +665,13 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||||
$sql .= " AND p.rowid = ".$this->id;
|
$sql .= " AND p.rowid = ".$this->id;
|
||||||
$sql .= " AND p.entity = ".$conf->entity;
|
$sql .= " AND p.entity = ".$conf->entity;
|
||||||
if ($amounts) $sql .= " GROUP BY fk_facture";
|
if ($amounts) {
|
||||||
|
if ($this->type == 'bank-transfer') {
|
||||||
|
$sql .= " GROUP BY fk_facture_fourn";
|
||||||
|
} else {
|
||||||
|
$sql .= " GROUP BY fk_facture";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -832,14 +884,11 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
|
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
|
||||||
}
|
}
|
||||||
$sql .= " AND s.rowid = f.fk_soc";
|
$sql .= " AND s.rowid = f.fk_soc";
|
||||||
//if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
|
$sql .= " AND f.fk_statut = 1"; // Invoice validated
|
||||||
$sql .= " AND f.fk_statut = 1";
|
|
||||||
$sql .= " AND f.paye = 0";
|
$sql .= " AND f.paye = 0";
|
||||||
$sql .= " AND pfd.traite = 0";
|
$sql .= " AND pfd.traite = 0";
|
||||||
$sql .= " AND f.total_ttc > 0";
|
$sql .= " AND f.total_ttc > 0";
|
||||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
|
|
||||||
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__."::Read invoices, sql=".$sql, LOG_DEBUG);
|
dol_syslog(__METHOD__."::Read invoices, sql=".$sql, LOG_DEBUG);
|
||||||
|
|
||||||
@ -883,14 +932,14 @@ class BonPrelevement extends CommonObject
|
|||||||
foreach ($factures as $key => $fac)
|
foreach ($factures as $key => $fac)
|
||||||
{
|
{
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
$fact = new Facture($this->db);
|
$tmpinvoice = new Facture($this->db);
|
||||||
} else {
|
} else {
|
||||||
$fact = new FactureFournisseur($this->db);
|
$tmpinvoice = new FactureFournisseur($this->db);
|
||||||
}
|
}
|
||||||
$resfetch = $fact->fetch($fac[0]);
|
$resfetch = $tmpinvoice->fetch($fac[0]);
|
||||||
if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice
|
if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice
|
||||||
{
|
{
|
||||||
if ($soc->fetch($fact->socid) >= 0)
|
if ($soc->fetch($tmpinvoice->socid) >= 0)
|
||||||
{
|
{
|
||||||
$bac = new CompanyBankAccount($this->db);
|
$bac = new CompanyBankAccount($this->db);
|
||||||
$bac->fetch(0, $soc->id);
|
$bac->fetch(0, $soc->id);
|
||||||
@ -914,9 +963,9 @@ class BonPrelevement extends CommonObject
|
|||||||
$i++;
|
$i++;
|
||||||
//dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG);
|
//dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG);
|
||||||
} else {
|
} else {
|
||||||
dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
|
dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$tmpinvoice->socid." ".$soc->name, LOG_WARNING);
|
||||||
$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$tmpinvoice->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||||
$this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
$this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$tmpinvoice->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING);
|
dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING);
|
||||||
@ -948,15 +997,13 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
if (count($factures_prev) > 0)
|
if (count($factures_prev) > 0)
|
||||||
{
|
{
|
||||||
if ($mode == 'real')
|
if ($mode == 'real') {
|
||||||
{
|
|
||||||
$ok = 1;
|
$ok = 1;
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans("ModeWarning"); // "Option for real mode was not set, we stop after this simulation\n";
|
print $langs->trans("ModeWarning"); // "Option for real mode was not set, we stop after this simulation\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1025,6 +1072,12 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
|
if ($type != 'bank-transfer') {
|
||||||
|
$fact = new Facture($this->db);
|
||||||
|
} else {
|
||||||
|
$fact = new FactureFournisseur($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create withdrawal receipt in database
|
* Create withdrawal receipt in database
|
||||||
*/
|
*/
|
||||||
@ -1033,11 +1086,14 @@ class BonPrelevement extends CommonObject
|
|||||||
foreach ($factures_prev as $fac) // Add a link in database for each invoice
|
foreach ($factures_prev as $fac) // Add a link in database for each invoice
|
||||||
{
|
{
|
||||||
// Fetch invoice
|
// Fetch invoice
|
||||||
$fact = new Facture($this->db);
|
$result = $fact->fetch($fac[0]);
|
||||||
$fact->fetch($fac[0]);
|
if ($result < 0) {
|
||||||
|
$this->error = 'ERRORBONPRELEVEMENT Failed to load invoice with id '.$fac[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add standing order
|
* Add standing order. This add record into llx_prelevement_lignes
|
||||||
*
|
*
|
||||||
* $fac[0] : invoice_id
|
* $fac[0] : invoice_id
|
||||||
* $fac[1] : ???
|
* $fac[1] : ???
|
||||||
@ -1048,9 +1104,7 @@ class BonPrelevement extends CommonObject
|
|||||||
* $fac[6] : cle rib
|
* $fac[6] : cle rib
|
||||||
* $fac[7] : amount
|
* $fac[7] : amount
|
||||||
* $fac[8] : client nom
|
* $fac[8] : client nom
|
||||||
* $fac[2] : client id
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type);
|
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type);
|
||||||
if ($ri <> 0)
|
if ($ri <> 0)
|
||||||
{
|
{
|
||||||
@ -1065,7 +1119,6 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " WHERE rowid = ".$fac[1];
|
$sql .= " WHERE rowid = ".$fac[1];
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -1078,10 +1131,10 @@ class BonPrelevement extends CommonObject
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Create file of direct debit order or credit transfer into a XML file
|
* Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG);
|
dol_syslog(__METHOD__."::Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
|
||||||
|
|
||||||
if (count($factures_prev) > 0)
|
if (count($factures_prev) > 0)
|
||||||
{
|
{
|
||||||
@ -1089,6 +1142,9 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->reference_remise = $ref;
|
$this->reference_remise = $ref;
|
||||||
|
|
||||||
$id = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
$id = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||||
|
if ($type == 'bank-transfer') {
|
||||||
|
$id = $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT;
|
||||||
|
}
|
||||||
$account = new Account($this->db);
|
$account = new Account($this->db);
|
||||||
if ($account->fetch($id) > 0)
|
if ($account->fetch($id) > 0)
|
||||||
{
|
{
|
||||||
@ -1107,17 +1163,23 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->factures = $factures_prev_id;
|
$this->factures = $factures_prev_id;
|
||||||
$this->context['factures_prev'] = $factures_prev;
|
$this->context['factures_prev'] = $factures_prev;
|
||||||
|
|
||||||
// Generation of SEPA file $this->filename
|
// Generation of direct debit or credti transfer file $this->filename (May be a SEPA file for european countries)
|
||||||
// This also the the property $this->total that is included into file
|
// This also set the property $this->total with amount that is included into file
|
||||||
$result = $this->generate($format, $executiondate, $type);
|
$result = $this->generate($format, $executiondate, $type);
|
||||||
|
if ($result < 0) {
|
||||||
|
/*var_dump($this->error);
|
||||||
|
var_dump($this->invoice_in_error); */
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
||||||
}
|
}
|
||||||
//var_dump($factures_prev);exit;
|
//var_dump($this->total);exit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update total defined after generation of file
|
* Update total defined after generation of file
|
||||||
*/
|
*/
|
||||||
|
if (! $error) {
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
||||||
$sql .= " SET amount = ".price2num($this->total);
|
$sql .= " SET amount = ".price2num($this->total);
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
@ -1129,6 +1191,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger)
|
||||||
{
|
{
|
||||||
@ -1146,11 +1209,11 @@ class BonPrelevement extends CommonObject
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
return count($factures_prev);
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count($factures_prev);
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1396,7 +1459,7 @@ class BonPrelevement extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param string $format FRST, RCUR or ALL
|
* @param string $format FRST, RCUR or ALL
|
||||||
* @param string $executiondate Date to execute transfer
|
* @param string $executiondate Date to execute transfer
|
||||||
* @param string $type 'direct-debit' or 'credit-transfer'
|
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||||
* @return int >=0 if OK, <0 if KO
|
* @return int >=0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function generate($format = 'ALL', $executiondate = '', $type = 'direct-debit')
|
public function generate($format = 'ALL', $executiondate = '', $type = 'direct-debit')
|
||||||
@ -1424,12 +1487,9 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$found++;
|
$found++;
|
||||||
|
|
||||||
if ($type == 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
print 'TODO';
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
/**
|
/**
|
||||||
* SECTION CREATION FICHIER SEPA
|
* SECTION CREATION FICHIER SEPA - DIRECT DEBIT
|
||||||
*/
|
*/
|
||||||
// SEPA Initialisation
|
// SEPA Initialisation
|
||||||
$CrLf = "\n";
|
$CrLf = "\n";
|
||||||
@ -1451,9 +1511,10 @@ class BonPrelevement extends CommonObject
|
|||||||
* Section Debitor (sepa Debiteurs bloc lines)
|
* Section Debitor (sepa Debiteurs bloc lines)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
$sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||||
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||||
$sql .= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
|
$sql .= " f.ref as fac, pf.fk_facture as idfac,";
|
||||||
|
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
|
||||||
$sql .= " FROM";
|
$sql .= " FROM";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
|
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
|
||||||
@ -1464,42 +1525,51 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||||
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||||
$sql .= " AND pf.fk_facture = f.rowid";
|
$sql .= " AND pf.fk_facture = f.rowid";
|
||||||
|
$sql .= " AND f.fk_soc = soc.rowid";
|
||||||
$sql .= " AND soc.fk_pays = c.rowid";
|
$sql .= " AND soc.fk_pays = c.rowid";
|
||||||
$sql .= " AND soc.rowid = f.fk_soc";
|
|
||||||
$sql .= " AND rib.fk_soc = f.fk_soc";
|
$sql .= " AND rib.fk_soc = f.fk_soc";
|
||||||
$sql .= " AND rib.default_rib = 1";
|
$sql .= " AND rib.default_rib = 1";
|
||||||
$sql .= " AND rib.type = 'ban'";
|
$sql .= " AND rib.type = 'ban'";
|
||||||
//print $sql;
|
|
||||||
|
|
||||||
// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
|
// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
$cachearraytotestduplicate = array();
|
||||||
|
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
if (! empty($cachearraytotestduplicate[$obj->idfac])) {
|
||||||
|
$this->error = $langs->trans('ErrorCompanyHasDuplicateDefaultBAN', $obj->socid);
|
||||||
|
$this->invoice_in_error[$obj->idfac] = $this->error;
|
||||||
|
$result = -2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
|
||||||
|
|
||||||
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
|
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
|
||||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum);
|
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
|
||||||
$this->total = $this->total + $obj->somme;
|
$this->total = $this->total + $obj->somme;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$nbtotalDrctDbtTxInf = $i;
|
$nbtotalDrctDbtTxInf = $i;
|
||||||
} else {
|
} else {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
|
fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf
|
// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all $nbtotalDrctDbtTxInf
|
||||||
if ($result != -2)
|
if ($result != -2)
|
||||||
{
|
{
|
||||||
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format);
|
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format, $type);
|
||||||
} else {
|
|
||||||
fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION CREATION SEPA FILE
|
* SECTION CREATION SEPA FILE - ISO200022
|
||||||
*/
|
*/
|
||||||
// SEPA File Header
|
// SEPA File Header
|
||||||
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
|
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
|
||||||
@ -1507,7 +1577,7 @@ class BonPrelevement extends CommonObject
|
|||||||
fputs($this->file, ' <CstmrDrctDbtInitn>'.$CrLf);
|
fputs($this->file, ' <CstmrDrctDbtInitn>'.$CrLf);
|
||||||
// SEPA Group header
|
// SEPA Group header
|
||||||
fputs($this->file, ' <GrpHdr>'.$CrLf);
|
fputs($this->file, ' <GrpHdr>'.$CrLf);
|
||||||
fputs($this->file, ' <MsgId>'.('PREL'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
|
fputs($this->file, ' <MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
|
||||||
fputs($this->file, ' <CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
|
fputs($this->file, ' <CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
|
||||||
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
|
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
|
||||||
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
|
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
|
||||||
@ -1532,21 +1602,135 @@ class BonPrelevement extends CommonObject
|
|||||||
fputs($this->file, ' </PmtInf>'.$CrLf);
|
fputs($this->file, ' </PmtInf>'.$CrLf);
|
||||||
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
|
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
|
||||||
fputs($this->file, '</Document>'.$CrLf);
|
fputs($this->file, '</Document>'.$CrLf);
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
|
||||||
|
*/
|
||||||
|
// SEPA Initialisation
|
||||||
|
$CrLf = "\n";
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
|
$dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S');
|
||||||
|
|
||||||
|
$date_actu = $now;
|
||||||
|
if (!empty($executiondate)) $date_actu = $executiondate;
|
||||||
|
|
||||||
|
$dateTime_YMD = dol_print_date($date_actu, '%Y%m%d');
|
||||||
|
$dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S');
|
||||||
|
$fileCrediteurSection = '';
|
||||||
|
$fileEmetteurSection = '';
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Section Creditor (sepa Crediteurs bloc lines)
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||||
|
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||||
|
$sql .= " f.ref as fac, pf.fk_facture_fourn as idfac,";
|
||||||
|
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
|
||||||
|
$sql .= " FROM";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
|
||||||
|
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
|
||||||
|
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||||
|
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||||
|
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||||
|
$sql .= " AND f.fk_soc = soc.rowid";
|
||||||
|
$sql .= " AND soc.fk_pays = c.rowid";
|
||||||
|
$sql .= " AND rib.fk_soc = f.fk_soc";
|
||||||
|
$sql .= " AND rib.default_rib = 1";
|
||||||
|
$sql .= " AND rib.type = 'ban'";
|
||||||
|
|
||||||
|
// Define $fileCrediteurSection. One section DrctDbtTxInf per invoice.
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$cachearraytotestduplicate = array();
|
||||||
|
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
if (! empty($cachearraytotestduplicate[$obj->idfac])) {
|
||||||
|
$this->error = $langs->trans('ErrorCompanyHasDuplicateDefaultBAN', $obj->socid);
|
||||||
|
$this->invoice_in_error[$obj->idfac] = $this->error;
|
||||||
|
$result = -2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
|
||||||
|
|
||||||
|
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
|
||||||
|
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
|
||||||
|
$this->total = $this->total + $obj->somme;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$nbtotalDrctDbtTxInf = $i;
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
fputs($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
|
||||||
|
$result = -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all $nbtotalDrctDbtTxInf
|
||||||
|
if ($result != -2) {
|
||||||
|
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format, $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
|
||||||
|
*/
|
||||||
|
// SEPA File Header
|
||||||
|
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
|
||||||
|
fputs($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
|
||||||
|
fputs($this->file, ' <CstmrCdtTrfInitn>'.$CrLf);
|
||||||
|
// SEPA Group header
|
||||||
|
fputs($this->file, ' <GrpHdr>'.$CrLf);
|
||||||
|
fputs($this->file, ' <MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
|
||||||
|
fputs($this->file, ' <CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
|
||||||
|
fputs($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
|
||||||
|
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
|
||||||
|
fputs($this->file, ' <InitgPty>'.$CrLf);
|
||||||
|
fputs($this->file, ' <Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf);
|
||||||
|
fputs($this->file, ' <Id>'.$CrLf);
|
||||||
|
fputs($this->file, ' <PrvtId>'.$CrLf);
|
||||||
|
fputs($this->file, ' <Othr>'.$CrLf);
|
||||||
|
fputs($this->file, ' <Id>'.$conf->global->PRELEVEMENT_ICS.'</Id>'.$CrLf);
|
||||||
|
fputs($this->file, ' </Othr>'.$CrLf);
|
||||||
|
fputs($this->file, ' </PrvtId>'.$CrLf);
|
||||||
|
fputs($this->file, ' </Id>'.$CrLf);
|
||||||
|
fputs($this->file, ' </InitgPty>'.$CrLf);
|
||||||
|
fputs($this->file, ' </GrpHdr>'.$CrLf);
|
||||||
|
// SEPA File Emetteur (mycompany)
|
||||||
|
if ($result != -2)
|
||||||
|
{ fputs($this-> file, $fileEmetteurSection); }
|
||||||
|
// SEPA File Creditors
|
||||||
|
if ($result != -2)
|
||||||
|
{ fputs($this-> file, $fileCrediteurSection); }
|
||||||
|
// SEPA FILE FOOTER
|
||||||
|
fputs($this->file, ' </PmtInf>'.$CrLf);
|
||||||
|
fputs($this->file, ' </CstmrCdtTrfInitn>'.$CrLf);
|
||||||
|
fputs($this->file, '</Document>'.$CrLf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build file for Other Countries with unknow format
|
// Build file for Other Countries with unknow format
|
||||||
if (!$found)
|
if (!$found)
|
||||||
{
|
{
|
||||||
if ($type == 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
$sql = "SELECT pl.amount";
|
$sql = "SELECT pl.amount";
|
||||||
$sql .= " FROM";
|
$sql .= " FROM";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
|
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||||
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||||
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||||
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
$sql .= " AND pf.fk_facture = f.rowid";
|
||||||
|
|
||||||
// Lines
|
// Lines
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -1570,11 +1754,11 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql = "SELECT pl.amount";
|
$sql = "SELECT pl.amount";
|
||||||
$sql .= " FROM";
|
$sql .= " FROM";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
|
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||||
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
|
||||||
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
|
||||||
$sql .= " AND pf.fk_facture = f.rowid";
|
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||||
|
|
||||||
// Lines
|
// Lines
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -1611,6 +1795,22 @@ class BonPrelevement extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate dynamically a RUM number for a customer bank account
|
||||||
|
*
|
||||||
|
* @param string $row_code_client Customer code (soc.code_client)
|
||||||
|
* @param int $row_datec Creation date of bank account (rib.datec)
|
||||||
|
* @param string $row_drum Id of customer bank account (rib.rowid)
|
||||||
|
* @return string RUM number
|
||||||
|
*/
|
||||||
|
public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
|
||||||
|
return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Write recipient of request (customer)
|
* Write recipient of request (customer)
|
||||||
@ -1624,9 +1824,11 @@ class BonPrelevement extends CommonObject
|
|||||||
* @param string $ref ref of invoice
|
* @param string $ref ref of invoice
|
||||||
* @param int $facid id of invoice
|
* @param int $facid id of invoice
|
||||||
* @param string $rib_dom rib domiciliation
|
* @param string $rib_dom rib domiciliation
|
||||||
|
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||||
* @return void
|
* @return void
|
||||||
|
* @see EnregDestinataireSEPA()
|
||||||
*/
|
*/
|
||||||
public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '')
|
public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '', $type = 'direct-debit')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
fputs($this->file, "06");
|
fputs($this->file, "06");
|
||||||
@ -1683,22 +1885,6 @@ class BonPrelevement extends CommonObject
|
|||||||
fputs($this->file, "\n");
|
fputs($this->file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build RUM number for a customer bank account
|
|
||||||
*
|
|
||||||
* @param string $row_code_client Customer code (soc.code_client)
|
|
||||||
* @param int $row_datec Creation date of bank account (rib.datec)
|
|
||||||
* @param string $row_drum Id of customer bank account (rib.rowid)
|
|
||||||
* @return string RUM number
|
|
||||||
*/
|
|
||||||
public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
|
|
||||||
{
|
|
||||||
global $langs;
|
|
||||||
$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
|
|
||||||
return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
|
||||||
}
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Write recipient of request (customer)
|
* Write recipient of request (customer)
|
||||||
@ -1720,9 +1906,11 @@ class BonPrelevement extends CommonObject
|
|||||||
* @param string $row_datec rib.datec,
|
* @param string $row_datec rib.datec,
|
||||||
* @param string $row_drum rib.rowid used to generate rum
|
* @param string $row_drum rib.rowid used to generate rum
|
||||||
* @param string $row_rum rib.rum Rum defined on company bank account
|
* @param string $row_rum rib.rum Rum defined on company bank account
|
||||||
|
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||||
* @return string Return string with SEPA part DrctDbtTxInf
|
* @return string Return string with SEPA part DrctDbtTxInf
|
||||||
|
* @see EnregDestinataire()
|
||||||
*/
|
*/
|
||||||
public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum)
|
public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum, $type = 'direct-debit')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -1730,7 +1918,7 @@ class BonPrelevement extends CommonObject
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
$CrLf = "\n";
|
$CrLf = "\n";
|
||||||
$Rowing = sprintf("%06d", $row_idfac);
|
$Rowing = sprintf("%010d", $row_idfac);
|
||||||
|
|
||||||
// Define value for RUM
|
// Define value for RUM
|
||||||
// Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId)
|
// Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId)
|
||||||
@ -1739,10 +1927,12 @@ class BonPrelevement extends CommonObject
|
|||||||
// Define date of RUM signature
|
// Define date of RUM signature
|
||||||
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
|
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
|
||||||
|
|
||||||
|
if ($type != 'bank-transfer') {
|
||||||
|
// SEPA Paiement Information of buyer for Direct debit
|
||||||
$XML_DEBITOR = '';
|
$XML_DEBITOR = '';
|
||||||
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
||||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||||
$XML_DEBITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
$XML_DEBITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||||
$XML_DEBITOR .= ' </PmtId>'.$CrLf;
|
$XML_DEBITOR .= ' </PmtId>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
$XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||||
@ -1774,22 +1964,71 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_DEBITOR .= ' </Id>'.$CrLf;
|
$XML_DEBITOR .= ' </Id>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' </DbtrAcct>'.$CrLf;
|
$XML_DEBITOR .= ' </DbtrAcct>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <RmtInf>'.$CrLf;
|
$XML_DEBITOR .= ' <RmtInf>'.$CrLf;
|
||||||
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
// A string with some information on payment - 140 max
|
||||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
|
|
||||||
$XML_DEBITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
|
$XML_DEBITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
|
||||||
$XML_DEBITOR .= ' </RmtInf>'.$CrLf;
|
$XML_DEBITOR .= ' </RmtInf>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf;
|
$XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf;
|
||||||
return $XML_DEBITOR;
|
return $XML_DEBITOR;
|
||||||
|
} else {
|
||||||
|
// SEPA Paiement Information of seller for Credit Transfer
|
||||||
|
$XML_CREDITOR = '';
|
||||||
|
$XML_CREDITOR .= ' <CdtTrfTxInf>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <PmtId>'.$CrLf;
|
||||||
|
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||||
|
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||||
|
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <Amt>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </Amt>'.$CrLf;
|
||||||
|
/*
|
||||||
|
$XML_CREDITOR .= ' <DrctDbtTx>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <MndtRltdInf>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <AmdmntInd>false</AmdmntInd>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </MndtRltdInf>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </DrctDbtTx>'.$CrLf;
|
||||||
|
*/
|
||||||
|
//$XML_CREDITOR .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <CdtrAgt>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <FinInstnId>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <BIC>'.$row_bic.'</BIC>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </FinInstnId>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </CdtrAgt>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <Cdtr>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <PstlAdr>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||||
|
$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
|
$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
|
if (trim($addressline1)) $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
|
||||||
|
if (trim($addressline2)) $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </PstlAdr>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </Cdtr>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <CdtrAcct>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <Id>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </Id>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </CdtrAcct>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' <RmtInf>'.$CrLf;
|
||||||
|
// A string with some information on payment - 140 max
|
||||||
|
$XML_CREDITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
|
||||||
|
$XML_CREDITOR .= ' </RmtInf>'.$CrLf;
|
||||||
|
$XML_CREDITOR .= ' </CdtTrfTxInf>'.$CrLf;
|
||||||
|
return $XML_CREDITOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Write sender of request (me)
|
* Write sender of request (me).
|
||||||
*
|
*
|
||||||
|
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||||
* @return void
|
* @return void
|
||||||
|
* @see EnregEmetteurSEPA()
|
||||||
*/
|
*/
|
||||||
public function EnregEmetteur()
|
public function EnregEmetteur($type = 'direct-debit')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
fputs($this->file, "03");
|
fputs($this->file, "03");
|
||||||
@ -1861,9 +2100,11 @@ class BonPrelevement extends CommonObject
|
|||||||
* @param float $total Total
|
* @param float $total Total
|
||||||
* @param string $CrLf End of line character
|
* @param string $CrLf End of line character
|
||||||
* @param string $format FRST or RCUR or ALL
|
* @param string $format FRST or RCUR or ALL
|
||||||
|
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||||
* @return string String with SEPA Sender
|
* @return string String with SEPA Sender
|
||||||
|
* @see EnregEmetteur()
|
||||||
*/
|
*/
|
||||||
public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST')
|
public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST', $type = 'direct-debit')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
// SEPA INITIALISATION
|
// SEPA INITIALISATION
|
||||||
@ -1890,7 +2131,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$this->raison_sociale = $account->proprio;
|
$this->raison_sociale = $account->proprio;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Récupération info demandeur
|
// Get pending payments
|
||||||
$sql = "SELECT rowid, ref";
|
$sql = "SELECT rowid, ref";
|
||||||
$sql .= " FROM";
|
$sql .= " FROM";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_bons as pb";
|
$sql .= " ".MAIN_DB_PREFIX."prelevement_bons as pb";
|
||||||
@ -1901,15 +2142,15 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
// DONNEES BRUTES : par la suite Rows['XXX'] de la requete au dessus
|
|
||||||
$country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||||
$IdBon = sprintf("%05d", $obj->rowid);
|
$IdBon = sprintf("%05d", $obj->rowid);
|
||||||
$RefBon = $obj->ref;
|
$RefBon = $obj->ref;
|
||||||
|
|
||||||
// SEPA Paiement Information
|
if ($type != 'bank-transfer') {
|
||||||
|
// SEPA Paiement Information of my company for Direct debit
|
||||||
$XML_SEPA_INFO = '';
|
$XML_SEPA_INFO = '';
|
||||||
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
|
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <PmtInfId>'.('PREL'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
|
$XML_SEPA_INFO .= ' <PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <PmtMtd>DD</PmtMtd>'.$CrLf;
|
$XML_SEPA_INFO .= ' <PmtMtd>DD</PmtMtd>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
|
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
|
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
|
||||||
@ -1951,7 +2192,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
|
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
||||||
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf;
|
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
|
||||||
$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
|
$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
|
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
|
||||||
@ -1964,9 +2205,71 @@ class BonPrelevement extends CommonObject
|
|||||||
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
|
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;
|
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;
|
||||||
|
} else {
|
||||||
|
// SEPA Paiement Information of my company for Credit Transfer
|
||||||
|
$XML_SEPA_INFO = '';
|
||||||
|
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <PmtMtd>TRF</PmtMtd>'.$CrLf;
|
||||||
|
//$XML_SEPA_INFO .= ' <BtchBookg>False</BtchBookg>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
|
||||||
|
/*
|
||||||
|
$XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Cd>TRF</Cd>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <CtgyPurp><Cd>SECU</Cd></CtgyPurp>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
|
||||||
|
*/
|
||||||
|
$XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Dbtr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||||
|
$addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
|
$addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")));
|
||||||
|
if ($addressline1) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline1.'</AdrLine>'.$CrLf;
|
||||||
|
if ($addressline2) $XML_SEPA_INFO .= ' <AdrLine>'.$addressline2.'</AdrLine>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </Dbtr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <DbtrAcct>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </DbtrAcct>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <DbtrAgt>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <FinInstnId>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </DbtrAgt>'.$CrLf;
|
||||||
|
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
|
||||||
|
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
|
||||||
|
/*$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Othr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </Othr>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </PrvtId>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
||||||
|
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
|
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
|
||||||
$result = -2;
|
|
||||||
}
|
}
|
||||||
return $XML_SEPA_INFO;
|
return $XML_SEPA_INFO;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class LignePrelevement
|
|||||||
|
|
||||||
$langs->load("withdrawals");
|
$langs->load("withdrawals");
|
||||||
$this->statuts[0] = $langs->trans("StatusWaiting");
|
$this->statuts[0] = $langs->trans("StatusWaiting");
|
||||||
$this->statuts[2] = $langs->trans("StatusCredited");
|
$this->statuts[2] = $langs->trans("StatusPaid");
|
||||||
$this->statuts[3] = $langs->trans("StatusRefused");
|
$this->statuts[3] = $langs->trans("StatusRefused");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -88,11 +88,9 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
|
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
|
||||||
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
|
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
setEventMessages($bprev->error, $bprev->errors, 'errors');
|
||||||
} elseif ($result == 0)
|
} elseif ($result == 0) {
|
||||||
{
|
|
||||||
$mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format);
|
$mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format);
|
||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
$mesg .= '<br>'."\n";
|
$mesg .= '<br>'."\n";
|
||||||
@ -101,7 +99,11 @@ if (empty($reshook))
|
|||||||
$mesg .= '<span class="warning">'.$val."</span><br>\n";
|
$mesg .= '<span class="warning">'.$val."</span><br>\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ($type != 'bank-transfer') {
|
||||||
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
|
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("CreditTransferOrderCreated", $bprev->getNomUrl(1)), null);
|
||||||
|
}
|
||||||
|
|
||||||
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
|
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
|
||||||
exit;
|
exit;
|
||||||
@ -366,11 +368,16 @@ if ($resql)
|
|||||||
|
|
||||||
// RUM
|
// RUM
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $thirdpartystatic->display_rib('rum');
|
$rumtoshow = $thirdpartystatic->display_rib('rum');
|
||||||
|
if ($rumtoshow) {
|
||||||
|
print $rumtoshow;
|
||||||
$format = $thirdpartystatic->display_rib('format');
|
$format = $thirdpartystatic->display_rib('format');
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
if ($format) print ' ('.$format.')';
|
if ($format) print ' ('.$format.')';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print img_warning($langs->trans("NoBankAccount"));
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Amount
|
// Amount
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|||||||
@ -105,14 +105,17 @@ if ($type != 'bank-transfer') {
|
|||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
$thirdpartystatic = new Societe($db);
|
$thirdpartystatic = new Societe($db);
|
||||||
|
if ($type == 'bank-transfer') {
|
||||||
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
} else {
|
||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new Facture($db);
|
||||||
|
}
|
||||||
|
|
||||||
// List of requests
|
// List of requests
|
||||||
|
|
||||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc,";
|
$sql = "SELECT f.ref, f.rowid, f.total_ttc,";
|
||||||
$sql .= " s.nom as name, s.rowid as socid,";
|
$sql .= " s.nom as name, s.rowid as socid,";
|
||||||
$sql .= " pfd.date_demande as date_demande,";
|
$sql .= " pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande";
|
||||||
$sql .= " pfd.fk_user_demande";
|
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||||
} else {
|
} else {
|
||||||
@ -126,6 +129,7 @@ $sql .= " AND f.entity IN (".getEntity('invoice').")";
|
|||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||||
if (!$status) $sql .= " AND pfd.traite = 0";
|
if (!$status) $sql .= " AND pfd.traite = 0";
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
if ($status) $sql .= " AND pfd.traite = ".$status;
|
if ($status) $sql .= " AND pfd.traite = ".$status;
|
||||||
$sql .= " AND f.total_ttc > 0";
|
$sql .= " AND f.total_ttc > 0";
|
||||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||||
@ -141,7 +145,6 @@ if ($search_facture) $sql .= natural_search("f.ref", $search_facture);
|
|||||||
if ($search_societe) $sql .= natural_search("s.nom", $search_societe);
|
if ($search_societe) $sql .= natural_search("s.nom", $search_societe);
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
@ -173,9 +176,9 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
|
$newcardbutton = '<a class="marginrightonly" href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php">'.$langs->trans("Back").'</a>';
|
$newcardbutton = '<a class="marginrightonly" href="'.DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php">'.$langs->trans("Back").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
|
||||||
@ -190,6 +193,14 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
|
|
||||||
|
$label = 'NewStandingOrder';
|
||||||
|
$typefilter = '';
|
||||||
|
if ($type == 'bank-transfer') {
|
||||||
|
$label = 'NewPaymentByBankTransfer';
|
||||||
|
$typefilter = 'type='.$type;
|
||||||
|
}
|
||||||
|
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php'.($typefilter ? '?'.$typefilter : ''));
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
print '<table class="liste centpercent">';
|
print '<table class="liste centpercent">';
|
||||||
@ -197,7 +208,7 @@ print '<table class="liste centpercent">';
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
|
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
|
||||||
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
|
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
|
||||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
|
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
|
||||||
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
|
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -220,12 +231,12 @@ while ($i < min($num, $limit))
|
|||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if (empty($obj)) break; // Should not happen
|
if (empty($obj)) break; // Should not happen
|
||||||
|
|
||||||
|
$invoicestatic->fetch($obj->rowid);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Ref facture
|
// Ref facture
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$invoicestatic->id = $obj->rowid;
|
|
||||||
$invoicestatic->ref = $obj->ref;
|
|
||||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -235,7 +246,9 @@ while ($i < min($num, $limit))
|
|||||||
print $thirdpartystatic->getNomUrl(1, 'customer');
|
print $thirdpartystatic->getNomUrl(1, 'customer');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
print '<td class="right">';
|
||||||
|
print price($obj->amount, 1, $langs, 1, -1, -1, $conf->currency).' / '.price($obj->total_ttc, 1, $langs, 1, -1, -1, $conf->currency);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_demande), 'day').'</td>';
|
print '<td class="center">'.dol_print_date($db->jdate($obj->date_demande), 'day').'</td>';
|
||||||
|
|
||||||
|
|||||||
@ -32,21 +32,21 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('banks', 'categories', 'companies', 'withdrawals', 'bills'));
|
$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals'));
|
||||||
|
|
||||||
// Securite acces client
|
// Securite acces client
|
||||||
if ($user->socid > 0) accessforbidden();
|
if ($user->socid > 0) accessforbidden();
|
||||||
|
|
||||||
// Get supervariables
|
// Get supervariables
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$socid = GETPOST('socid', 'int');
|
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
$socid = GETPOST('socid', 'int');
|
||||||
$type = GETPOST('type', 'aZ09');
|
$type = GETPOST('type', 'aZ09');
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
@ -57,6 +57,17 @@ if (!$sortorder) $sortorder = 'DESC';
|
|||||||
|
|
||||||
$object = new BonPrelevement($db);
|
$object = new BonPrelevement($db);
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
|
||||||
|
|
||||||
|
if (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -75,19 +86,17 @@ if ($id > 0 || $ref)
|
|||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php'.($object->type != 'bank-transfer' ? '' : '?type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border centpercent tableforfield">';
|
print '<table class="border centpercent tableforfield">'."\n";
|
||||||
|
|
||||||
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||||
// Status
|
|
||||||
//print '<tr><td>'.$langs->trans('Status').'</td><td>'.$object->getLibStatut(1).'</td></tr>';
|
|
||||||
|
|
||||||
if ($object->date_trans <> 0)
|
if ($object->date_trans <> 0)
|
||||||
{
|
{
|
||||||
@ -96,7 +105,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -119,7 +128,9 @@ if ($id > 0 || $ref)
|
|||||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("BankToReceiveWithdraw");
|
$labelofbankfield = "BankToReceiveWithdraw";
|
||||||
|
if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer';
|
||||||
|
print $langs->trans($labelofbankfield);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($acc->id > 0)
|
if ($acc->id > 0)
|
||||||
@ -128,9 +139,13 @@ if ($id > 0 || $ref)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
$labelfororderfield = 'WithdrawalFile';
|
||||||
|
if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile';
|
||||||
|
print $langs->trans($labelfororderfield).'</td><td>';
|
||||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
$modulepart = 'prelevement';
|
||||||
|
if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer';
|
||||||
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -143,19 +158,31 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
|
|
||||||
// List of invoices
|
// List of invoices
|
||||||
$sql = "SELECT pf.rowid,";
|
$sql = "SELECT pf.rowid, p.type,";
|
||||||
$sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
|
$sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||||
|
if ($object->type != 'bank-transfer') {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
|
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
} else {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
|
}
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
|
||||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||||
$sql .= " AND f.fk_soc = s.rowid";
|
$sql .= " AND f.fk_soc = s.rowid";
|
||||||
|
if ($object->type != 'bank-transfer') {
|
||||||
$sql .= " AND pf.fk_facture = f.rowid";
|
$sql .= " AND pf.fk_facture = f.rowid";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND pf.fk_facture_fourn = f.rowid";
|
||||||
|
}
|
||||||
|
if ($object->type != 'bank-transfer') {
|
||||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||||
|
}
|
||||||
if ($object->id > 0) $sql .= " AND p.rowid=".$object->id;
|
if ($object->id > 0) $sql .= " AND p.rowid=".$object->id;
|
||||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -164,8 +191,8 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
{
|
{
|
||||||
$page = 0;
|
$page = 0;
|
||||||
@ -175,10 +202,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($result)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param = "&id=".$id;
|
$param = "&id=".$id;
|
||||||
@ -207,22 +234,28 @@ if ($result)
|
|||||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("StatusDebitCredit", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$totalinvoices = 0;
|
$totalinvoices = 0;
|
||||||
$totalamount_requested = 0;
|
$totalamount_requested = 0;
|
||||||
|
|
||||||
|
$invoicetmpcustomer = new Facture($db);
|
||||||
|
$invoicetmpsupplier = new FactureFournisseur($db);
|
||||||
|
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$invoicetmp->id = $obj->facid;
|
if ($obj->type == 'bank-transfer') {
|
||||||
$invoicetmp->ref = $obj->ref;
|
$invoicetmp = $invoicetmpsupplier;
|
||||||
|
} else {
|
||||||
|
$invoicetmp = $invoicetmpcustomer;
|
||||||
|
}
|
||||||
|
$invoicetmp->fetch($obj->facid);
|
||||||
|
|
||||||
$thirdpartytmp->id = $obj->socid;
|
$thirdpartytmp->fetch($obj->socid);
|
||||||
$thirdpartytmp->name = $obj->name;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
@ -243,14 +276,15 @@ if ($result)
|
|||||||
// Status of requests
|
// Status of requests
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
|
|
||||||
if ($obj->statut == 0)
|
if ($obj->statut == 0) {
|
||||||
{
|
|
||||||
print '-';
|
print '-';
|
||||||
} elseif ($obj->statut == 2)
|
} elseif ($obj->statut == 2) {
|
||||||
{
|
if ($obj->type == 'bank-transfer') {
|
||||||
|
print $langs->trans("StatusDebited");
|
||||||
|
} else {
|
||||||
print $langs->trans("StatusCredited");
|
print $langs->trans("StatusCredited");
|
||||||
} elseif ($obj->statut == 3)
|
}
|
||||||
{
|
} elseif ($obj->statut == 3) {
|
||||||
print '<b>'.$langs->trans("StatusRefused").'</b>';
|
print '<b>'.$langs->trans("StatusRefused").'</b>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/prelevement/fiche-rejet.php
|
* \file htdocs/compta/prelevement/fiche-rejet.php
|
||||||
* \ingroup prelevement
|
* \ingroup prelevement
|
||||||
* \brief Withdraw reject
|
* \brief Debit order or credit transfer reject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("banks", "categories", 'withdrawals', 'bills'));
|
$langs->loadLangs(array("banks", "categories", 'withdrawals', 'bills'));
|
||||||
|
|
||||||
// Securite acces client
|
// Security check
|
||||||
if ($user->socid > 0) accessforbidden();
|
if ($user->socid > 0) accessforbidden();
|
||||||
|
|
||||||
// Get supervariables
|
// Get supervariables
|
||||||
@ -55,6 +55,15 @@ $pagenext = $page + 1;
|
|||||||
|
|
||||||
$object = new BonPrelevement($db);
|
$object = new BonPrelevement($db);
|
||||||
|
|
||||||
|
// 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 (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +80,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php'.($object->type != 'bank-transfer' ? '' : '?type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||||
|
|
||||||
@ -83,13 +92,6 @@ if ($prev_id > 0 || $ref)
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
|
||||||
/*
|
|
||||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
|
||||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($object->date_trans <> 0)
|
if ($object->date_trans <> 0)
|
||||||
{
|
{
|
||||||
$muser = new User($db);
|
$muser = new User($db);
|
||||||
@ -97,7 +99,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -120,7 +122,9 @@ if ($prev_id > 0 || $ref)
|
|||||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("BankToReceiveWithdraw");
|
$labelofbankfield = "BankToReceiveWithdraw";
|
||||||
|
if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer';
|
||||||
|
print $langs->trans($labelofbankfield);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($acc->id > 0)
|
if ($acc->id > 0)
|
||||||
@ -129,9 +133,13 @@ if ($prev_id > 0 || $ref)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
$labelfororderfield = 'WithdrawalFile';
|
||||||
|
if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile';
|
||||||
|
print $langs->trans($labelfororderfield).'</td><td>';
|
||||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
$modulepart = 'prelevement';
|
||||||
|
if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer';
|
||||||
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -142,6 +150,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$rej = new RejetPrelevement($db, $user);
|
$rej = new RejetPrelevement($db, $user);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -221,7 +230,7 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/prelevement/fiche-stat.php
|
* \file htdocs/compta/prelevement/fiche-stat.php
|
||||||
* \ingroup prelevement
|
* \ingroup prelevement
|
||||||
* \brief Prelevement statistics
|
* \brief Debit order or credit transfer statistics
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -54,6 +54,17 @@ $pagenext = $page + 1;
|
|||||||
|
|
||||||
$object = new BonPrelevement($db);
|
$object = new BonPrelevement($db);
|
||||||
|
|
||||||
|
// 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 (!$user->rights->prelevement->bons->lire && $object->type != 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transfer') {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -68,7 +79,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php'.($object->type != 'bank-transfer' ? '' : '?type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||||
|
|
||||||
@ -80,13 +91,6 @@ if ($prev_id > 0 || $ref)
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
|
||||||
/*
|
|
||||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
|
||||||
print '<td>'.$object->getLibStatut(1).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($object->date_trans <> 0)
|
if ($object->date_trans <> 0)
|
||||||
{
|
{
|
||||||
$muser = new User($db);
|
$muser = new User($db);
|
||||||
@ -94,7 +98,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -117,7 +121,9 @@ if ($prev_id > 0 || $ref)
|
|||||||
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
$result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("BankToReceiveWithdraw");
|
$labelofbankfield = "BankToReceiveWithdraw";
|
||||||
|
if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer';
|
||||||
|
print $langs->trans($labelofbankfield);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($acc->id > 0)
|
if ($acc->id > 0)
|
||||||
@ -126,23 +132,26 @@ if ($prev_id > 0 || $ref)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans("WithdrawalFile").'</td><td>';
|
$labelfororderfield = 'WithdrawalFile';
|
||||||
|
if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile';
|
||||||
|
print $langs->trans($labelfororderfield).'</td><td>';
|
||||||
$relativepath = 'receipts/'.$object->ref.'.xml';
|
$relativepath = 'receipts/'.$object->ref.'.xml';
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart=prelevement&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
$modulepart = 'prelevement';
|
||||||
|
if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer';
|
||||||
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
dol_print_error($db);
|
||||||
print $langs->trans("Error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stats
|
* Stats
|
||||||
*/
|
*/
|
||||||
$ligne = new LignePrelevement($db);
|
$line = new LignePrelevement($db);
|
||||||
|
|
||||||
$sql = "SELECT sum(pl.amount), pl.statut";
|
$sql = "SELECT sum(pl.amount), pl.statut";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
@ -168,7 +177,7 @@ if ($prev_id > 0 || $ref)
|
|||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
|
|
||||||
print $ligne->LibStatut($row[1], 1);
|
print $line->LibStatut($row[1], 1);
|
||||||
|
|
||||||
print '</td><td class="right">';
|
print '</td><td class="right">';
|
||||||
print price($row[0]);
|
print price($row[0]);
|
||||||
|
|||||||
@ -683,7 +683,7 @@ class PaymentSocialContribution extends CommonObject
|
|||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
if (empty($this->ref)) $this->ref = $this->lib;
|
if (empty($this->ref)) $this->ref = $this->lib;
|
||||||
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
$label = $langs->trans("Payment").': '.$this->ref;
|
||||||
|
|
||||||
if (!empty($this->id)) {
|
if (!empty($this->id)) {
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -458,6 +459,23 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setprospectcontactlevel' && $user->rights->societe->contact->creer)
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->fk_prospectlevel = GETPOST('prospect_contact_level_id', 'alpha');
|
||||||
|
$result = $object->update($object->id, $user);
|
||||||
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
// set communication status
|
||||||
|
if ($action == 'setstcomm')
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact');
|
||||||
|
$result = $object->update($object->id, $user);
|
||||||
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$triggersendname = 'CONTACT_SENTBYMAIL';
|
$triggersendname = 'CONTACT_SENTBYMAIL';
|
||||||
$paramname = 'id';
|
$paramname = 'id';
|
||||||
@ -1333,8 +1351,51 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
|
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
|
||||||
|
if ($object->thirdparty->client == 2 || $object->thirdparty->client == 3)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Level of prospect
|
||||||
|
print '<tr><td class="titlefield nowrap">';
|
||||||
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||||
|
print $langs->trans('ProspectLevel');
|
||||||
|
print '<td>';
|
||||||
|
if ($action != 'editlevel' && $user->rights->societe->contact->creer) print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editlevel&id=' . $object->id . '">' . img_edit($langs->trans('Modify'), 1) . '</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
|
if ($action == 'editlevel') {
|
||||||
|
$formcompany->formProspectContactLevel($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_prospectlevel, 'prospect_contact_level_id', 1);
|
||||||
|
} else {
|
||||||
|
print $object->getLibProspLevel();
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Status of prospection
|
||||||
|
$object->loadCacheOfProspStatus();
|
||||||
|
print '<tr><td>' . $langs->trans("StatusProsp") . '</td><td>' . $object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||||
|
print ' ';
|
||||||
|
print '<div class="floatright">';
|
||||||
|
foreach ($object->cacheprospectstatus as $key => $val) {
|
||||||
|
$titlealt = 'default';
|
||||||
|
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||||
|
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
|
||||||
|
}
|
||||||
|
print '</div></td></tr>';
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -89,6 +90,8 @@ class Contact extends CommonObject
|
|||||||
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||||
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
'priv' =>array('type'=>'smallint(6)', 'label'=>'Private', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
|
'priv' =>array('type'=>'smallint(6)', 'label'=>'Private', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
|
||||||
|
'fk_stcomm' =>array('type'=>'integer', 'label'=>'Fk stcommcontact', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
|
||||||
|
'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
|
||||||
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
|
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
|
||||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||||
@ -209,6 +212,11 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
public $roles = array();
|
public $roles = array();
|
||||||
|
|
||||||
|
public $cacheprospectstatus = array();
|
||||||
|
public $fk_prospectlevel;
|
||||||
|
public $stcomm_id;
|
||||||
|
public $statut_commercial;
|
||||||
|
public $stcomm_picto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -224,6 +232,10 @@ class Contact extends CommonObject
|
|||||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||||
if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0;
|
if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0;
|
||||||
if (!empty($conf->global->SOCIETE_DISABLE_CONTACTS)) $this->fields['thirdparty']['enabled'] = 0;
|
if (!empty($conf->global->SOCIETE_DISABLE_CONTACTS)) $this->fields['thirdparty']['enabled'] = 0;
|
||||||
|
if (empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour
|
||||||
|
$this->field['fk_stcomm']['enabled'] = 0;
|
||||||
|
$this->field['fk_prospectlevel']['enabled'] = 0;
|
||||||
|
}
|
||||||
$this->statut = 1; // By default, status is enabled
|
$this->statut = 1; // By default, status is enabled
|
||||||
|
|
||||||
// Unset fields that are disabled
|
// Unset fields that are disabled
|
||||||
@ -328,6 +340,7 @@ class Contact extends CommonObject
|
|||||||
$sql .= ", firstname";
|
$sql .= ", firstname";
|
||||||
$sql .= ", fk_user_creat";
|
$sql .= ", fk_user_creat";
|
||||||
$sql .= ", priv";
|
$sql .= ", priv";
|
||||||
|
$sql.= ", fk_stcommcontact";
|
||||||
$sql .= ", statut";
|
$sql .= ", statut";
|
||||||
$sql .= ", canvas";
|
$sql .= ", canvas";
|
||||||
$sql .= ", entity";
|
$sql .= ", entity";
|
||||||
@ -341,6 +354,7 @@ class Contact extends CommonObject
|
|||||||
$sql .= "'".$this->db->escape($this->firstname)."',";
|
$sql .= "'".$this->db->escape($this->firstname)."',";
|
||||||
$sql .= " ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "null").",";
|
$sql .= " ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "null").",";
|
||||||
$sql .= " ".$this->db->escape($this->priv).",";
|
$sql .= " ".$this->db->escape($this->priv).",";
|
||||||
|
$sql.= " 0,";
|
||||||
$sql .= " ".$this->db->escape($this->statut).",";
|
$sql .= " ".$this->db->escape($this->statut).",";
|
||||||
$sql .= " ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null").",";
|
$sql .= " ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null").",";
|
||||||
$sql .= " ".$this->db->escape($this->entity).",";
|
$sql .= " ".$this->db->escape($this->entity).",";
|
||||||
@ -465,6 +479,11 @@ class Contact extends CommonObject
|
|||||||
$sql .= ", phone_perso = ".(isset($this->phone_perso) ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
$sql .= ", phone_perso = ".(isset($this->phone_perso) ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
$sql .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||||
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
||||||
|
$sql .= ", fk_prospectcontactlevel = '".$this->db->escape($this->fk_prospectlevel)."'";
|
||||||
|
if (isset($this->stcomm_id))
|
||||||
|
{
|
||||||
|
$sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0");
|
||||||
|
}
|
||||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
|
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
|
||||||
$sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL");
|
$sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL");
|
||||||
@ -818,6 +837,7 @@ class Contact extends CommonObject
|
|||||||
$sql .= " c.socialnetworks,";
|
$sql .= " c.socialnetworks,";
|
||||||
$sql .= " c.photo,";
|
$sql .= " c.photo,";
|
||||||
$sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
|
$sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
|
||||||
|
$sql.= " c.fk_prospectcontactlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,";
|
||||||
$sql .= " c.import_key,";
|
$sql .= " c.import_key,";
|
||||||
$sql .= " c.datec as date_creation, c.tms as date_modification,";
|
$sql .= " c.datec as date_creation, c.tms as date_modification,";
|
||||||
$sql .= " co.label as country, co.code as country_code,";
|
$sql .= " co.label as country, co.code as country_code,";
|
||||||
@ -829,6 +849,7 @@ class Contact extends CommonObject
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||||
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcommcontact as st ON c.fk_stcommcontact = st.id';
|
||||||
if ($id) $sql .= " WHERE c.rowid = ".$id;
|
if ($id) $sql .= " WHERE c.rowid = ".$id;
|
||||||
else {
|
else {
|
||||||
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
|
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
|
||||||
@ -884,6 +905,14 @@ class Contact extends CommonObject
|
|||||||
$this->poste = $obj->poste;
|
$this->poste = $obj->poste;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
|
|
||||||
|
$this->fk_prospectlevel = $obj->fk_prospectcontactlevel;
|
||||||
|
|
||||||
|
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcommcontact);
|
||||||
|
$libelle=($transcode!='StatusProspect'.$obj->fk_stcommcontact?$transcode:$obj->stcomm);
|
||||||
|
$this->stcomm_id = $obj->fk_stcommcontact; // id statut commercial
|
||||||
|
$this->statut_commercial = $libelle; // libelle statut commercial
|
||||||
|
$this->stcomm_picto = $obj->stcomm_picto; // Picto statut commercial
|
||||||
|
|
||||||
$this->phone_pro = trim($obj->phone);
|
$this->phone_pro = trim($obj->phone);
|
||||||
$this->fax = trim($obj->fax);
|
$this->fax = trim($obj->fax);
|
||||||
$this->phone_perso = trim($obj->phone_perso);
|
$this->phone_perso = trim($obj->phone_perso);
|
||||||
@ -1701,4 +1730,137 @@ class Contact extends CommonObject
|
|||||||
return $error * -1;
|
return $error * -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load array of prospect status
|
||||||
|
*
|
||||||
|
* @param int $active 1=Active only, 0=Not active only, -1=All
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function loadCacheOfProspStatus($active = 1)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$sql = "SELECT id, code, libelle as label, picto FROM " . MAIN_DB_PREFIX . "c_stcommcontact";
|
||||||
|
if ($active >= 0) $sql .= " WHERE active = " . $active;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$this->cacheprospectstatus[$obj->id] = array('id' => $obj->id, 'code' => $obj->code, 'label' => ($langs->trans("ST_" . strtoupper($obj->code)) == "ST_" . strtoupper($obj->code)) ? $obj->label : $langs->trans("ST_" . strtoupper($obj->code)), 'picto' => $obj->picto);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return prostect level
|
||||||
|
*
|
||||||
|
* @return string Libelle
|
||||||
|
*/
|
||||||
|
public function getLibProspLevel()
|
||||||
|
{
|
||||||
|
return $this->libProspLevel($this->fk_prospectlevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return label of prospect level
|
||||||
|
*
|
||||||
|
* @param int $fk_prospectlevel Prospect level
|
||||||
|
* @return string label of level
|
||||||
|
*/
|
||||||
|
public function libProspLevel($fk_prospectlevel)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$lib = $langs->trans("ProspectLevel" . $fk_prospectlevel);
|
||||||
|
// If lib not found in language file, we get label from cache/databse
|
||||||
|
if ($lib == $langs->trans("ProspectLevel" . $fk_prospectlevel))
|
||||||
|
{
|
||||||
|
$lib = $langs->getLabelFromKey($this->db, $fk_prospectlevel, 'c_prospectlevel', 'code', 'label');
|
||||||
|
}
|
||||||
|
return $lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set prospect level
|
||||||
|
*
|
||||||
|
* @param User $user Utilisateur qui definie la remise
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
* @deprecated Use update function instead
|
||||||
|
*/
|
||||||
|
public function setProspectLevel(User $user)
|
||||||
|
{
|
||||||
|
return $this->update($this->id, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return status of prospect
|
||||||
|
*
|
||||||
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||||
|
* @param string $label Label to use for status for added status
|
||||||
|
* @return string Libelle
|
||||||
|
*/
|
||||||
|
public function getLibProspCommStatut($mode = 0, $label = '')
|
||||||
|
{
|
||||||
|
return $this->libProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return label of a given status
|
||||||
|
*
|
||||||
|
* @param int|string $statut Id or code for prospection status
|
||||||
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||||
|
* @param string $label Label to use for status for added status
|
||||||
|
* @param string $picto Name of image file to show ('filenew', ...)
|
||||||
|
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||||
|
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||||
|
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||||
|
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||||
|
* @return string Libelle du statut
|
||||||
|
*/
|
||||||
|
public function libProspCommStatut($statut, $mode = 0, $label = '', $picto = '')
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load('customers');
|
||||||
|
|
||||||
|
if ($mode == 2)
|
||||||
|
{
|
||||||
|
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1");
|
||||||
|
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0");
|
||||||
|
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1");
|
||||||
|
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2");
|
||||||
|
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3");
|
||||||
|
else {
|
||||||
|
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($mode == 3)
|
||||||
|
{
|
||||||
|
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto);
|
||||||
|
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto);
|
||||||
|
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto);
|
||||||
|
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto);
|
||||||
|
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto);
|
||||||
|
else {
|
||||||
|
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($mode == 4)
|
||||||
|
{
|
||||||
|
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1");
|
||||||
|
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0");
|
||||||
|
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1");
|
||||||
|
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2");
|
||||||
|
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3");
|
||||||
|
else {
|
||||||
|
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Error, mode/status not found";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -91,6 +92,8 @@ $search_town = GETPOST('search_town', 'alpha');
|
|||||||
$search_import_key = GETPOST("search_import_key", "alpha");
|
$search_import_key = GETPOST("search_import_key", "alpha");
|
||||||
$search_country = GETPOST("search_country", 'intcomma');
|
$search_country = GETPOST("search_country", 'intcomma');
|
||||||
$search_roles = GETPOST("search_roles", 'array');
|
$search_roles = GETPOST("search_roles", 'array');
|
||||||
|
$search_level = GETPOST("search_level", "array");
|
||||||
|
$search_stcomm = GETPOST('search_stcomm', 'int');
|
||||||
|
|
||||||
if ($search_status == '') $search_status = 1; // always display active customer first
|
if ($search_status == '') $search_status = 1; // always display active customer first
|
||||||
|
|
||||||
@ -141,7 +144,7 @@ $hookmanager->initHooks(array('contactlist'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label('contact');
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
@ -181,6 +184,11 @@ $arrayfields = array(
|
|||||||
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||||
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||||
);
|
);
|
||||||
|
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
|
||||||
|
$arrayfields['p.fk_prospectcontactlevel'] = array('label'=>"ProspectLevelShort", 'checked'=>1, 'position'=>210);
|
||||||
|
$arrayfields['p.fk_stcommcontact'] = array('label'=>"StatusProsp", 'checked'=>1, 'position'=>215);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($conf->socialnetworks->enabled)) {
|
if (!empty($conf->socialnetworks->enabled)) {
|
||||||
foreach ($socialnetworks as $key => $value) {
|
foreach ($socialnetworks as $key => $value) {
|
||||||
if ($value['active']) {
|
if ($value['active']) {
|
||||||
@ -198,7 +206,13 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
|||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
$arrayfields["ef.".$key] = array(
|
||||||
|
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||||
|
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
|
||||||
|
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||||
|
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
|
||||||
|
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
@ -256,6 +270,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$search_priv = "";
|
$search_priv = "";
|
||||||
|
$search_stcomm='';
|
||||||
|
$search_level='';
|
||||||
$search_status = -1;
|
$search_status = -1;
|
||||||
$search_categ = '';
|
$search_categ = '';
|
||||||
$search_categ_thirdparty = '';
|
$search_categ_thirdparty = '';
|
||||||
@ -273,6 +289,17 @@ if (empty($reshook))
|
|||||||
$permissiontodelete = $user->rights->societe->supprimer;
|
$permissiontodelete = $user->rights->societe->supprimer;
|
||||||
$uploaddir = $conf->societe->dir_output;
|
$uploaddir = $conf->societe->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
|
if ($action == 'setstcomm')
|
||||||
|
{
|
||||||
|
$object = new Contact($db);
|
||||||
|
$result = $object->fetch(GETPOST('stcommcontactid'));
|
||||||
|
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact');
|
||||||
|
$result = $object->update($object->id, $user);
|
||||||
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search_priv < 0) $search_priv = '';
|
if ($search_priv < 0) $search_priv = '';
|
||||||
@ -287,12 +314,36 @@ $formother = new FormOther($db);
|
|||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic = new Contact($db);
|
$contactstatic = new Contact($db);
|
||||||
|
|
||||||
|
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
|
||||||
|
$contactstatic->loadCacheOfProspStatus();
|
||||||
|
}
|
||||||
|
|
||||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||||
|
|
||||||
|
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||||
|
$tab_level = array();
|
||||||
|
$sql = "SELECT code, label, sortorder";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||||
|
$sql.= " WHERE active > 0";
|
||||||
|
$sql.= " ORDER BY sortorder";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
// Compute level text
|
||||||
|
$level=$langs->trans($obj->code);
|
||||||
|
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
||||||
|
$tab_level[$obj->code] = $level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||||
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
||||||
$sql .= " p.socialnetworks, p.photo,";
|
$sql .= " p.socialnetworks, p.photo,";
|
||||||
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||||
|
$sql.= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
|
||||||
$sql .= " co.label as country, co.code as country_code";
|
$sql .= " co.label as country, co.code as country_code";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
@ -306,6 +357,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
|||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
|
||||||
if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||||
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||||
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
|
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||||
@ -319,6 +371,8 @@ if (!empty($userid)) // propre au commercial
|
|||||||
{
|
{
|
||||||
$sql .= " AND p.fk_user_creat=".$db->escape($userid);
|
$sql .= " AND p.fk_user_creat=".$db->escape($userid);
|
||||||
}
|
}
|
||||||
|
if ($search_level) $sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3);
|
||||||
|
if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2);
|
||||||
|
|
||||||
// Filter to exclude not owned private contacts
|
// Filter to exclude not owned private contacts
|
||||||
if ($search_priv != '0' && $search_priv != '1')
|
if ($search_priv != '0' && $search_priv != '1')
|
||||||
@ -403,8 +457,8 @@ if ($view == "recent")
|
|||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
{
|
{
|
||||||
$page = 0;
|
$page = 0;
|
||||||
@ -414,14 +468,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (!$result)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
@ -461,8 +515,14 @@ if ($search_email != '') $param .= '&search_email='.urlencode($search_email)
|
|||||||
if ($search_no_email != '') $param .= '&search_no_email='.urlencode($search_no_email);
|
if ($search_no_email != '') $param .= '&search_no_email='.urlencode($search_no_email);
|
||||||
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
||||||
if ($search_priv == '0' || $search_priv == '1') $param .= "&search_priv=".urlencode($search_priv);
|
if ($search_priv == '0' || $search_priv == '1') $param .= "&search_priv=".urlencode($search_priv);
|
||||||
|
if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm);
|
||||||
|
if (is_array($search_level) && count($search_level)) {
|
||||||
|
foreach ($search_level as $slevel) {
|
||||||
|
$param.='&search_level[]='.urlencode($slevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($search_import_key != '') $param .= '&search_import_key='.urlencode($search_import_key);
|
if ($search_import_key != '') $param .= '&search_import_key='.urlencode($search_import_key);
|
||||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||||
if (count($search_roles) > 0) $param .= implode('&search_roles[]=', $search_roles);
|
if (count($search_roles) > 0) $param .= implode('&search_roles[]=', $search_roles);
|
||||||
|
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
@ -678,6 +738,25 @@ if (!empty($arrayfields['p.priv']['checked']))
|
|||||||
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
|
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Prospect level
|
||||||
|
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Prospect status
|
||||||
|
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
|
$arraystcomm=array();
|
||||||
|
foreach ($contactstatic->cacheprospectstatus as $key => $val)
|
||||||
|
{
|
||||||
|
$arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
|
||||||
|
}
|
||||||
|
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', 'nowrap ');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
|
|
||||||
@ -746,6 +825,8 @@ if (!empty($conf->socialnetworks->enabled)) {
|
|||||||
}
|
}
|
||||||
if (!empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
|
if (!empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
if (!empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||||
|
if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
|
if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
// Hook fields
|
// Hook fields
|
||||||
@ -777,7 +858,7 @@ $i = 0;
|
|||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
|
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||||
$contactstatic->lastname = $obj->lastname;
|
$contactstatic->lastname = $obj->lastname;
|
||||||
@ -796,6 +877,8 @@ while ($i < min($num, $limit))
|
|||||||
$contactstatic->country_code = $obj->country_code;
|
$contactstatic->country_code = $obj->country_code;
|
||||||
$contactstatic->photo = $obj->photo;
|
$contactstatic->photo = $obj->photo;
|
||||||
|
|
||||||
|
$contactstatic->fk_prospectlevel=$obj->fk_prospectcontactlevel;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
@ -924,6 +1007,30 @@ while ($i < min($num, $limit))
|
|||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
|
||||||
|
{
|
||||||
|
// Prospect level
|
||||||
|
print '<td class="center">';
|
||||||
|
print $contactstatic->getLibProspLevel();
|
||||||
|
print "</td>";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
|
||||||
|
{
|
||||||
|
// Prospect status
|
||||||
|
print '<td class="center nowrap"><div class="nowrap">';
|
||||||
|
print '<div class="inline-block">' . $contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
|
||||||
|
print '</div> - <div class="inline-block">';
|
||||||
|
foreach ($contactstatic->cacheprospectstatus as $key => $val) {
|
||||||
|
$titlealt = 'default';
|
||||||
|
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||||
|
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommcontactid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
|
||||||
|
}
|
||||||
|
print '</div></div></td>';
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
@ -975,7 +1082,7 @@ while ($i < min($num, $limit))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($resql);
|
||||||
|
|
||||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@ -2393,6 +2393,7 @@ class Contrat extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
$outputlangs->load("products");
|
||||||
|
|
||||||
if (!dol_strlen($modele)) {
|
if (!dol_strlen($modele)) {
|
||||||
$modele = 'strato';
|
$modele = 'strato';
|
||||||
@ -2776,18 +2777,16 @@ class ContratLigne extends CommonObjectLine
|
|||||||
* Load object in memory from database
|
* Load object in memory from database
|
||||||
*
|
*
|
||||||
* @param int $id Id object
|
* @param int $id Id object
|
||||||
* @param string $ref Ref of contract
|
* @param string $ref Ref of contract line
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetch($id, $ref = '')
|
public function fetch($id, $ref = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($id) && empty($ref)) return -1;
|
if (empty($id) && empty($ref)) return -1;
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql .= " t.rowid,";
|
$sql .= " t.rowid,";
|
||||||
|
|
||||||
$sql .= " t.tms,";
|
$sql .= " t.tms,";
|
||||||
$sql .= " t.fk_contrat,";
|
$sql .= " t.fk_contrat,";
|
||||||
$sql .= " t.fk_product,";
|
$sql .= " t.fk_product,";
|
||||||
@ -2888,10 +2887,14 @@ class ContratLigne extends CommonObjectLine
|
|||||||
$this->fk_user_cloture = $obj->fk_user_cloture;
|
$this->fk_user_cloture = $obj->fk_user_cloture;
|
||||||
$this->commentaire = $obj->commentaire;
|
$this->commentaire = $obj->commentaire;
|
||||||
$this->fk_fournprice = $obj->fk_fournprice;
|
$this->fk_fournprice = $obj->fk_fournprice;
|
||||||
|
|
||||||
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->fk_fournprice, $obj->pa_ht);
|
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->fk_fournprice, $obj->pa_ht);
|
||||||
$this->pa_ht = $marginInfos[0];
|
$this->pa_ht = $marginInfos[0];
|
||||||
$this->fk_unit = $obj->fk_unit;
|
$this->fk_unit = $obj->fk_unit;
|
||||||
|
|
||||||
|
$this->fetch_optionals();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $hookmanager->initHooks(array('contractlist'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label('contrat');
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
|
|||||||
@ -84,7 +84,7 @@ $hookmanager->initHooks(array('contractservicelist'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label('contratdet');
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@ if ($action == 'update' && !empty($permissiontoadd))
|
|||||||
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
|
||||||
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
|
||||||
} elseif ($object->fields[$key]['type'] == 'boolean') {
|
} elseif ($object->fields[$key]['type'] == 'boolean') {
|
||||||
$value = (GETPOST($key) == 'on' ? 1 : 0);
|
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
$value = GETPOST($key, 'alpha');
|
$value = GETPOST($key, 'alpha');
|
||||||
}
|
}
|
||||||
@ -285,6 +285,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
// Define output language
|
// Define output language
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
|
if (method_exists($object, 'generateDocument')) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||||
@ -298,6 +299,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
|
|
||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,10 +154,10 @@ if (empty($reshook))
|
|||||||
$arrayresult = array_merge($arrayresult, $hookmanager->resArray);
|
$arrayresult = array_merge($arrayresult, $hookmanager->resArray);
|
||||||
} else $arrayresult = $hookmanager->resArray;
|
} else $arrayresult = $hookmanager->resArray;
|
||||||
|
|
||||||
// This allow to keep a search entry to the top
|
// This pushes a search entry to the top
|
||||||
if (!empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) {
|
if (!empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) {
|
||||||
$key = 'searchinto'.$conf->global->DEFAULT_SEARCH_INTO_MODULE;
|
$key = 'searchinto'.$conf->global->DEFAULT_SEARCH_INTO_MODULE;
|
||||||
if (array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -10;
|
if (array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort on position
|
// Sort on position
|
||||||
|
|||||||
@ -268,6 +268,28 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->addr_to = $to;
|
||||||
|
$this->addr_cc = $addr_cc;
|
||||||
|
$this->addr_bcc = $addr_bcc;
|
||||||
|
$this->reply_to = $replyto;
|
||||||
|
$this->addr_from = $from;
|
||||||
|
$this->subject = $subject;
|
||||||
|
$this->errors_to = $errors_to;
|
||||||
|
$this->deliveryreceipt = $deliveryreceipt;
|
||||||
|
$this->trackid = $trackid;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
||||||
|
{
|
||||||
|
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||||
|
$this->addr_cc = '';
|
||||||
|
$this->addr_bcc = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
|
||||||
|
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
||||||
|
$addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||||
|
}
|
||||||
|
|
||||||
// We set all data according to choosed sending method.
|
// We set all data according to choosed sending method.
|
||||||
// We also set a value for ->msgid
|
// We also set a value for ->msgid
|
||||||
if ($this->sendmode == 'mail')
|
if ($this->sendmode == 'mail')
|
||||||
@ -327,16 +349,16 @@ class CMailFile
|
|||||||
$smtps->setCharSet($conf->file->character_set_client);
|
$smtps->setCharSet($conf->file->character_set_client);
|
||||||
|
|
||||||
// Encode subject if required.
|
// Encode subject if required.
|
||||||
$subjecttouse = $subject;
|
$subjecttouse = $this->subject;
|
||||||
if (!ascii_check($subjecttouse)) {
|
if (!ascii_check($subjecttouse)) {
|
||||||
$subjecttouse = $this->encodetorfc2822($subjecttouse);
|
$subjecttouse = $this->encodetorfc2822($subjecttouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
$smtps->setSubject($subjecttouse);
|
$smtps->setSubject($subjecttouse);
|
||||||
$smtps->setTO($this->getValidAddress($to, 0, 1));
|
$smtps->setTO($this->getValidAddress($this->addr_to, 0, 1));
|
||||||
$smtps->setFrom($this->getValidAddress($from, 0, 1));
|
$smtps->setFrom($this->getValidAddress($this->addr_from, 0, 1));
|
||||||
$smtps->setTrackId($trackid);
|
$smtps->setTrackId($this->trackid);
|
||||||
$smtps->setReplyTo($this->getValidAddress($replyto, 0, 1));
|
$smtps->setReplyTo($this->getValidAddress($this->replyto, 0, 1));
|
||||||
|
|
||||||
if (!empty($moreinheader)) $smtps->setMoreInHeader($moreinheader);
|
if (!empty($moreinheader)) $smtps->setMoreInHeader($moreinheader);
|
||||||
|
|
||||||
@ -374,17 +396,16 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$smtps->setCC($addr_cc);
|
$smtps->setCC($this->addr_cc);
|
||||||
$smtps->setBCC($addr_bcc);
|
$smtps->setBCC($this->addr_bcc);
|
||||||
$smtps->setErrorsTo($errors_to);
|
$smtps->setErrorsTo($this->errors_to);
|
||||||
$smtps->setDeliveryReceipt($deliveryreceipt);
|
$smtps->setDeliveryReceipt($this->deliveryreceipt);
|
||||||
|
|
||||||
$host = dol_getprefix('email');
|
$host = dol_getprefix('email');
|
||||||
$this->msgid = time().'.SMTPs-dolibarr-'.$trackid.'@'.$host;
|
$this->msgid = time().'.SMTPs-dolibarr-'.$this->trackid.'@'.$host;
|
||||||
|
|
||||||
$this->smtps = $smtps;
|
$this->smtps = $smtps;
|
||||||
} elseif ($this->sendmode == 'swiftmailer')
|
} elseif ($this->sendmode == 'swiftmailer') {
|
||||||
{
|
|
||||||
// Use Swift Mailer library
|
// Use Swift Mailer library
|
||||||
$host = dol_getprefix('email');
|
$host = dol_getprefix('email');
|
||||||
|
|
||||||
@ -401,8 +422,8 @@ class CMailFile
|
|||||||
//$this->message = new Swift_SignedMessage();
|
//$this->message = new Swift_SignedMessage();
|
||||||
// Adding a trackid header to a message
|
// Adding a trackid header to a message
|
||||||
$headers = $this->message->getHeaders();
|
$headers = $this->message->getHeaders();
|
||||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host);
|
$headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host);
|
||||||
$this->msgid = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
|
$this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
|
||||||
$headerID = $this->msgid;
|
$headerID = $this->msgid;
|
||||||
$msgid = $headers->get('Message-ID');
|
$msgid = $headers->get('Message-ID');
|
||||||
$msgid->setId($headerID);
|
$msgid->setId($headerID);
|
||||||
@ -411,14 +432,14 @@ class CMailFile
|
|||||||
|
|
||||||
// Give the message a subject
|
// Give the message a subject
|
||||||
try {
|
try {
|
||||||
$result = $this->message->setSubject($subject);
|
$result = $this->message->setSubject($this->subject);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the From address with an associative array
|
// Set the From address with an associative array
|
||||||
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
||||||
if (!empty($from)) {
|
if (! empty($this->addr_from)) {
|
||||||
try {
|
try {
|
||||||
if (! empty($conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING)) {
|
if (! empty($conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING)) {
|
||||||
// Prevent email spoofing for smtp server with a strict configuration
|
// Prevent email spoofing for smtp server with a strict configuration
|
||||||
@ -429,10 +450,10 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
$result = $this->message->setFrom($conf->global->MAIN_MAIL_SMTPS_ID);
|
$result = $this->message->setFrom($conf->global->MAIN_MAIL_SMTPS_ID);
|
||||||
} else {
|
} else {
|
||||||
$result = $this->message->setFrom($this->getArrayAddress($from));
|
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = $this->message->setFrom($this->getArrayAddress($from));
|
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
@ -440,17 +461,17 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the To addresses with an associative array
|
// Set the To addresses with an associative array
|
||||||
if (!empty($to)) {
|
if (! empty($this->addr_to)) {
|
||||||
try {
|
try {
|
||||||
$result = $this->message->setTo($this->getArrayAddress($to));
|
$result = $this->message->setTo($this->getArrayAddress($this->addr_to));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($replyto)) {
|
if (! empty($this->reply_to)) {
|
||||||
try {
|
try {
|
||||||
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
|
$result = $this->message->SetReplyTo($this->getArrayAddress($this->reply_to));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
@ -504,10 +525,10 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc));
|
if (! empty($this->addr_cc)) $this->message->setCc($this->getArrayAddress($this->addr_cc));
|
||||||
if (!empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc));
|
if (! empty($this->addr_bcc)) $this->message->setBcc($this->getArrayAddress($this->addr_bcc));
|
||||||
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
|
//if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to);
|
||||||
if (isset($deliveryreceipt) && $deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from));
|
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from));
|
||||||
} else {
|
} else {
|
||||||
// Send mail method not correctly defined
|
// Send mail method not correctly defined
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
@ -624,13 +645,6 @@ class CMailFile
|
|||||||
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
|
$keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
|
||||||
{
|
|
||||||
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
|
|
||||||
$this->addr_cc = '';
|
|
||||||
$this->addr_bcc = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Action according to choosed sending method
|
// Action according to choosed sending method
|
||||||
if ($this->sendmode == 'mail')
|
if ($this->sendmode == 'mail')
|
||||||
{
|
{
|
||||||
@ -772,14 +786,14 @@ class CMailFile
|
|||||||
$from = $this->smtps->getFrom('org');
|
$from = $this->smtps->getFrom('org');
|
||||||
if ($res && !$from)
|
if ($res && !$from)
|
||||||
{
|
{
|
||||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>Sender address '$from' invalid";
|
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - Sender address '$from' invalid";
|
||||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||||
$res = false;
|
$res = false;
|
||||||
}
|
}
|
||||||
$dest = $this->smtps->getTo();
|
$dest = $this->smtps->getTo();
|
||||||
if ($res && !$dest)
|
if ($res && !$dest)
|
||||||
{
|
{
|
||||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>Recipient address '$dest' invalid";
|
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - Recipient address '$dest' invalid";
|
||||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||||
$res = false;
|
$res = false;
|
||||||
}
|
}
|
||||||
@ -800,7 +814,7 @@ class CMailFile
|
|||||||
$res = true;
|
$res = true;
|
||||||
} else {
|
} else {
|
||||||
if (empty($this->error)) $this->error = $result;
|
if (empty($this->error)) $this->error = $result;
|
||||||
dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>".$this->error, LOG_ERR);
|
dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - ".$this->error, LOG_ERR);
|
||||||
$res = false;
|
$res = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1072,7 +1072,8 @@ abstract class CommonDocGenerator
|
|||||||
$parameters = array(
|
$parameters = array(
|
||||||
'curY' => &$curY,
|
'curY' => &$curY,
|
||||||
'columnText' => $columnText,
|
'columnText' => $columnText,
|
||||||
'colKey' => $colKey
|
'colKey' => $colKey,
|
||||||
|
'pdf' => &$pdf,
|
||||||
);
|
);
|
||||||
$reshook = $hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
@ -1286,7 +1287,7 @@ abstract class CommonDocGenerator
|
|||||||
{
|
{
|
||||||
// Sort extrafields by rank
|
// Sort extrafields by rank
|
||||||
uasort($fields, function ($a, $b) {
|
uasort($fields, function ($a, $b) {
|
||||||
return ($a->rank > $b->rank) ? -1 : 1;
|
return ($a->rank > $b->rank) ? 1 : -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// define some HTML content with style
|
// define some HTML content with style
|
||||||
|
|||||||
@ -1858,14 +1858,15 @@ abstract class CommonObject
|
|||||||
$row = $this->db->fetch_row($result);
|
$row = $this->db->fetch_row($result);
|
||||||
$this->ref_previous = $row[0];
|
$this->ref_previous = $row[0];
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||||
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 'fk_soc@societe') $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||||
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||||
|
} elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||||
elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||||
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||||
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($fieldid=='rowid' ? $this->id : $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($fieldid=='rowid' ? $this->id : $this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
@ -1876,8 +1877,10 @@ abstract class CommonObject
|
|||||||
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
||||||
$sql .= $filter;
|
$sql .= $filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 'fk_soc@societe') $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||||
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
|
$sql .= ' AND te.'.$tmparray[0].' = '.($tmparray[1] == 'societe' ? 's' : 'parenttable').'.rowid'; // If we need to link to this table to limit select to entity
|
||||||
|
} elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||||
@ -1890,6 +1893,10 @@ abstract class CommonObject
|
|||||||
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged) && $this->element != 'societe') {
|
||||||
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
|
$sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')';
|
||||||
|
}
|
||||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql .= ' AND te.fk_soc = '.$socid;
|
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql .= ' AND te.fk_soc = '.$socid;
|
||||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql .= ' AND (te.fk_soc = '.$socid.' OR te.fk_soc IS NULL)';
|
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql .= ' AND (te.fk_soc = '.$socid.' OR te.fk_soc IS NULL)';
|
||||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql .= ' AND te.rowid = '.$socid;
|
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql .= ' AND te.rowid = '.$socid;
|
||||||
@ -2840,12 +2847,14 @@ abstract class CommonObject
|
|||||||
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$newsuffix = $suffix;
|
||||||
|
|
||||||
// Special cas
|
// Special cas
|
||||||
//var_dump($this->table_element);exit;
|
if ($this->table_element == 'product' && $newsuffix == '_private') $newsuffix = '';
|
||||||
if ($this->table_element == 'product') $suffix = '';
|
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= " SET note".$suffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
|
$sql .= " SET note".$newsuffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
|
||||||
$sql .= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment')) ? "fk_user_mod" : "fk_user_modif")." = ".$user->id;
|
$sql .= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment')) ? "fk_user_mod" : "fk_user_modif")." = ".$user->id;
|
||||||
$sql .= " WHERE rowid =".$this->id;
|
$sql .= " WHERE rowid =".$this->id;
|
||||||
|
|
||||||
@ -5302,11 +5311,12 @@ abstract class CommonObject
|
|||||||
$new_array_options[$key] = null;
|
$new_array_options[$key] = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'price':
|
||||||
case 'double':
|
case 'double':
|
||||||
$value = price2num($value);
|
$value = price2num($value);
|
||||||
if (!is_numeric($value) && $value != '')
|
if (!is_numeric($value) && $value != '')
|
||||||
{
|
{
|
||||||
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
|
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." for ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
|
||||||
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
||||||
return -1;
|
return -1;
|
||||||
} elseif ($value == '')
|
} elseif ($value == '')
|
||||||
@ -5354,9 +5364,6 @@ abstract class CommonObject
|
|||||||
$new_array_options[$key] = $this->array_options[$key];
|
$new_array_options[$key] = $this->array_options[$key];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'price':
|
|
||||||
$new_array_options[$key] = price2num($this->array_options[$key]);
|
|
||||||
break;
|
|
||||||
case 'date':
|
case 'date':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
// If data is a string instead of a timestamp, we convert it
|
// If data is a string instead of a timestamp, we convert it
|
||||||
@ -5448,7 +5455,7 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
if (!isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
|
if (!isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously
|
||||||
{
|
{
|
||||||
if (in_array($tmpval, array('int', 'double'))) $sql .= ", 0";
|
if (in_array($tmpval, array('int', 'double', 'price'))) $sql .= ", 0";
|
||||||
else $sql .= ", ''";
|
else $sql .= ", ''";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6724,7 +6731,7 @@ abstract class CommonObject
|
|||||||
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
|
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
$out .= '<!-- showOptionalsInput --> ';
|
$out .= '<!-- showOptionals --> ';
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
|
|
||||||
$extrafields_collapse_num = '';
|
$extrafields_collapse_num = '';
|
||||||
@ -6858,7 +6865,7 @@ abstract class CommonObject
|
|||||||
// HTML, select, integer and text add default value
|
// HTML, select, integer and text add default value
|
||||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
|
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
|
||||||
{
|
{
|
||||||
if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
|
if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
|
||||||
else $value = $this->array_options['options_'.$key];
|
else $value = $this->array_options['options_'.$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6944,7 +6951,7 @@ abstract class CommonObject
|
|||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= '<!-- /showOptionalsInput --> '."\n";
|
$out .= '<!-- /showOptionals --> '."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7611,11 +7618,11 @@ abstract class CommonObject
|
|||||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
||||||
|
|
||||||
$keys = array();
|
$keys = array();
|
||||||
$values = array();
|
$values = array(); // Array to store string forged for SQL syntax
|
||||||
foreach ($fieldvalues as $k => $v) {
|
foreach ($fieldvalues as $k => $v) {
|
||||||
$keys[$k] = $k;
|
$keys[$k] = $k;
|
||||||
$value = $this->fields[$k];
|
$value = $this->fields[$k];
|
||||||
$values[$k] = $this->quote($v, $value);
|
$values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean and check mandatory
|
// Clean and check mandatory
|
||||||
@ -7625,8 +7632,7 @@ abstract class CommonObject
|
|||||||
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
|
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
|
||||||
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
|
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
|
||||||
|
|
||||||
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
|
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && (!isset($values[$key]) || $values[$key] === 'NULL') && is_null($this->fields[$key]['default']))
|
||||||
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
|
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
||||||
|
|||||||
@ -50,6 +50,16 @@ abstract class CommonObjectLine extends CommonObject
|
|||||||
public $fk_unit;
|
public $fk_unit;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the translation key from units dictionary.
|
* Returns the translation key from units dictionary.
|
||||||
* A langs->trans() must be called on result to get translated value.
|
* A langs->trans() must be called on result to get translated value.
|
||||||
@ -74,12 +84,12 @@ abstract class CommonObjectLine extends CommonObject
|
|||||||
$label_type = 'short_label';
|
$label_type = 'short_label';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'select '.$label_type.' from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
|
$sql = 'select '.$label_type.',code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql && $this->db->num_rows($resql) > 0)
|
if ($resql && $this->db->num_rows($resql) > 0)
|
||||||
{
|
{
|
||||||
$res = $this->db->fetch_array($resql);
|
$res = $this->db->fetch_array($resql);
|
||||||
$label = $res[$label_type];
|
$label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']);
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $label;
|
return $label;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -467,6 +467,26 @@ class dolReceiptPrinter extends Printer
|
|||||||
return $error;
|
return $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to delete a printer template in db
|
||||||
|
*
|
||||||
|
* @param int $templateid Template ID
|
||||||
|
* @return int 0 if OK; >0 if KO
|
||||||
|
*/
|
||||||
|
public function deleteTemplate($templateid)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
$error = 0;
|
||||||
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||||
|
$sql .= " WHERE rowid = ".((int) $this->db->escape($templateid));
|
||||||
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql) {
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
}
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to Update a printer template in db
|
* Function to Update a printer template in db
|
||||||
|
|||||||
@ -154,8 +154,8 @@ class ExtraFields
|
|||||||
|
|
||||||
|
|
||||||
public static $type2label = array(
|
public static $type2label = array(
|
||||||
'varchar'=>'String',
|
'varchar'=>'String1Line',
|
||||||
'text'=>'TextLong',
|
'text'=>'TextLongNLines',
|
||||||
'html'=>'HtmlText',
|
'html'=>'HtmlText',
|
||||||
'int'=>'Int',
|
'int'=>'Int',
|
||||||
'double'=>'Float',
|
'double'=>'Float',
|
||||||
@ -807,7 +807,7 @@ class ExtraFields
|
|||||||
/**
|
/**
|
||||||
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
|
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
|
||||||
*
|
*
|
||||||
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
||||||
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
||||||
* @return array Array of attributes keys+label for all extra fields.
|
* @return array Array of attributes keys+label for all extra fields.
|
||||||
*/
|
*/
|
||||||
@ -821,6 +821,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'thirdparty') $elementtype = 'societe';
|
if ($elementtype == 'thirdparty') $elementtype = 'societe';
|
||||||
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
||||||
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
|
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
|
||||||
|
if ($elementtype == 'stock_mouvement') $elementtype = 'movement';
|
||||||
|
|
||||||
$array_name_label = array();
|
$array_name_label = array();
|
||||||
|
|
||||||
@ -2025,6 +2026,8 @@ class ExtraFields
|
|||||||
$value_key = price2num($value_arr);
|
$value_key = price2num($value_arr);
|
||||||
} elseif (in_array($key_type, array('html'))) {
|
} elseif (in_array($key_type, array('html'))) {
|
||||||
$value_key = GETPOST("options_".$key, 'alpha');
|
$value_key = GETPOST("options_".$key, 'alpha');
|
||||||
|
} elseif (in_array($key_type, array('text'))) {
|
||||||
|
$value_key = GETPOST("options_".$key, 'alphanohtml');
|
||||||
} else {
|
} else {
|
||||||
$value_key = GETPOST("options_".$key);
|
$value_key = GETPOST("options_".$key);
|
||||||
if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';
|
if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';
|
||||||
|
|||||||
@ -35,6 +35,8 @@ class Fiscalyear extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $element = 'fiscalyear';
|
public $element = 'fiscalyear';
|
||||||
|
|
||||||
|
public $picto = 'technic';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
@ -97,6 +99,7 @@ class Fiscalyear extends CommonObject
|
|||||||
public $statuts = array();
|
public $statuts = array();
|
||||||
public $statuts_short = array();
|
public $statuts_short = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -267,6 +270,78 @@ class Fiscalyear extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return clicable link of object (with eventually picto)
|
||||||
|
*
|
||||||
|
* @param int $withpicto Add picto into link
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
|
* @return string String with URL
|
||||||
|
*/
|
||||||
|
public function getNomUrl($withpicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
|
||||||
|
{
|
||||||
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
if (empty($this->ref)) $this->ref = $this->id;
|
||||||
|
|
||||||
|
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
|
||||||
|
$url = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$this->id;
|
||||||
|
|
||||||
|
if (!$user->rights->accounting->fiscalyear->write)
|
||||||
|
$option = 'nolink';
|
||||||
|
|
||||||
|
if ($option !== 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||||
|
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($short) return $url;
|
||||||
|
|
||||||
|
$label = '';
|
||||||
|
|
||||||
|
if ($user->rights->accounting->fiscalyear->write) {
|
||||||
|
$label = '<u>'.$langs->trans("FiscalPeriod").'</u>';
|
||||||
|
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->id;
|
||||||
|
if (isset($this->statut)) {
|
||||||
|
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$linkclose = '';
|
||||||
|
if (empty($notooltip) && $user->rights->accounting->fiscalyear->write)
|
||||||
|
{
|
||||||
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
|
{
|
||||||
|
$label = $langs->trans("FiscalYear");
|
||||||
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
}
|
||||||
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
$linkclose .= ' class="classfortooltip"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$linkstart = '<a href="'.$url.'"';
|
||||||
|
$linkstart .= $linkclose.'>';
|
||||||
|
$linkend = '</a>';
|
||||||
|
|
||||||
|
if ($option === 'nolink') {
|
||||||
|
$linkstart = '';
|
||||||
|
$linkend = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= $linkstart;
|
||||||
|
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
|
if ($withpicto != 2) $result .= $this->ref;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give a label from a status
|
* Give a label from a status
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2641,9 +2641,9 @@ class Form
|
|||||||
|
|
||||||
$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
|
$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
|
||||||
if ($virtualstock > 0) {
|
if ($virtualstock > 0) {
|
||||||
$outval .= ' - <span class="product_line_stock_ok">';
|
$outval .= '<span class="product_line_stock_ok">';
|
||||||
} elseif ($virtualstock <= 0) {
|
} elseif ($virtualstock <= 0) {
|
||||||
$outval .= ' - <span class="product_line_stock_too_low">';
|
$outval .= '<span class="product_line_stock_too_low">';
|
||||||
}
|
}
|
||||||
$outval .= $virtualstock;
|
$outval .= $virtualstock;
|
||||||
$outval .= '</span>';
|
$outval .= '</span>';
|
||||||
@ -5830,7 +5830,7 @@ class Form
|
|||||||
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
||||||
|
|
||||||
// No immediate load of all database
|
// No immediate load of all database
|
||||||
$urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter).($moreparams ? $moreparams : '');
|
$urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter);
|
||||||
// Activate the auto complete using ajax call.
|
// Activate the auto complete using ajax call.
|
||||||
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
||||||
$out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
$out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
||||||
@ -6496,11 +6496,11 @@ class Form
|
|||||||
*/
|
*/
|
||||||
public static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage)
|
public static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user, $extrafields;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
|
||||||
|
|
||||||
$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage;
|
$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved seleteced properties
|
||||||
if (!empty($user->conf->$tmpvar))
|
if (!empty($user->conf->$tmpvar))
|
||||||
{
|
{
|
||||||
$tmparray = explode(',', $user->conf->$tmpvar);
|
$tmparray = explode(',', $user->conf->$tmpvar);
|
||||||
@ -6528,6 +6528,10 @@ class Form
|
|||||||
}
|
}
|
||||||
if ($val['label'])
|
if ($val['label'])
|
||||||
{
|
{
|
||||||
|
if (! empty($val['langfile']) && is_object($langs)) {
|
||||||
|
$langs->load($val['langfile']);
|
||||||
|
}
|
||||||
|
|
||||||
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
|
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
|
||||||
$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
|
$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||||
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -172,6 +173,58 @@ class FormCompany extends Form
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche formulaire de selection des niveau de prospection pour les contacts
|
||||||
|
*
|
||||||
|
* @param int $page Page
|
||||||
|
* @param int $selected Id or code preselected
|
||||||
|
* @param string $htmlname Nom du formulaire select
|
||||||
|
* @param int $empty Add empty value in list
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function formProspectContactLevel($page, $selected = '', $htmlname = 'prospect_contact_level_id', $empty = 0)
|
||||||
|
{
|
||||||
|
global $user, $langs;
|
||||||
|
|
||||||
|
print '<form method="post" action="' . $page . '">';
|
||||||
|
print '<input type="hidden" name="action" value="setprospectcontactlevel">';
|
||||||
|
print '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
$sql = "SELECT code, label";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectcontactlevel";
|
||||||
|
$sql .= " WHERE active > 0";
|
||||||
|
$sql .= " ORDER BY sortorder";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$options = array();
|
||||||
|
|
||||||
|
if ($empty)
|
||||||
|
{
|
||||||
|
$options[''] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$level = $langs->trans($obj->code);
|
||||||
|
|
||||||
|
if ($level == $obj->code)
|
||||||
|
{
|
||||||
|
$level = $langs->trans($obj->label);
|
||||||
|
}
|
||||||
|
|
||||||
|
$options[$obj->code] = $level;
|
||||||
|
}
|
||||||
|
|
||||||
|
print Form::selectarray($htmlname, $options, $selected);
|
||||||
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
|
if (!empty($htmlname) && $user->admin) print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||||
|
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
|
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user