Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
fab78de569
36
README.md
36
README.md
@ -3,13 +3,15 @@
|
||||

|
||||

|
||||
|
||||
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 an Open Source Software suite (written in PHP with optional JavaScript enhancements) 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.
|
||||
|
||||
Dolibarr has a large community ready to help you, free forums and [oficially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
|
||||
|
||||

|
||||
|
||||
@ -35,11 +37,15 @@ Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||
|
||||
### 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).
|
||||
|
||||
- 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, ...)
|
||||
|
||||
@ -70,13 +76,13 @@ If you don't have time to install it yourself, you can try some commercial 'read
|
||||
|
||||
## UPGRADING
|
||||
|
||||
Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
|
||||
|
||||
- At first make a backup of your Dolibarr files & than see 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).
|
||||
- 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.
|
||||
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*").
|
||||
|
||||
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
||||
- 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 in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||
|
||||
## WHAT'S NEW
|
||||
|
||||
@ -139,7 +145,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)
|
||||
|
||||
- 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:
|
||||
- Spanish Tax RE and ISPF
|
||||
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
|
||||
@ -149,7 +155,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 GDPR rules
|
||||
- ...
|
||||
- PDF or ODT generation for invoice, proposals, orders...
|
||||
- Flexible PDF & ODT generation for invoices, proposals, orders...
|
||||
- …
|
||||
|
||||
### System Environment / Requirements
|
||||
@ -167,12 +173,12 @@ These are features that Dolibarr does **not** yet fully support:
|
||||
|
||||
- Tasks dependencies in projects
|
||||
- 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)
|
||||
|
||||
## 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
|
||||
|
||||
@ -182,7 +188,7 @@ This project exists thanks to all the people who contribute. [[Contribute](https
|
||||
|
||||
## 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.
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ function length_accountg($account)
|
||||
|
||||
if ($account < 0 || is_empty($account)) return '';
|
||||
|
||||
if (!is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
|
||||
if (is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
|
||||
|
||||
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
|
||||
if (!is_empty($g)) {
|
||||
@ -131,7 +131,7 @@ function length_accounta($accounta)
|
||||
|
||||
if ($accounta < 0 || is_empty($accounta)) return '';
|
||||
|
||||
if (!is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
|
||||
if (is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
|
||||
|
||||
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
|
||||
if (!is_empty($a)) {
|
||||
|
||||
@ -424,7 +424,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -447,7 +447,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
@ -485,7 +485,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
/**
|
||||
* Show area for the customer to sign
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
@ -527,7 +527,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Project $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -617,7 +617,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Project $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -404,6 +404,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
|
||||
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
|
||||
// Line of free text
|
||||
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$newfreetext = '';
|
||||
$paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (!empty($conf->global->$paramfreetext))
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2011 Fabrice CHERRIER
|
||||
* Copyright (C) 2013-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013-2020 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
@ -500,7 +500,7 @@ class pdf_strato extends ModelePDFContract
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -550,7 +550,7 @@ class pdf_strato extends ModelePDFContract
|
||||
|
||||
/**
|
||||
* Show footer signature of page
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param int $tab_top tab height position
|
||||
* @param int $tab_height tab height
|
||||
* @param Translate $outputlangs Object language for output
|
||||
@ -579,8 +579,8 @@ class pdf_strato extends ModelePDFContract
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param CommonObject $object Object to show
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommonObject $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @return void
|
||||
|
||||
@ -671,7 +671,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Amount already paid
|
||||
* @param int $posy Start Position
|
||||
@ -772,7 +772,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -822,7 +822,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1065,7 +1065,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -662,7 +662,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
|
||||
@ -642,7 +642,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -866,7 +866,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param int $tab_top Tab top
|
||||
* @param int $tab_height Tab height
|
||||
* @param int $nexY next y
|
||||
@ -980,7 +980,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
/**
|
||||
* Show payments table
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object invoice
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
@ -1092,7 +1092,7 @@ class pdf_standard extends ModeleExpenseReport
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -917,7 +917,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Show payments table
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object invoice
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
@ -1055,7 +1055,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param tcpdf $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
@ -1225,7 +1225,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param TCPDI $pdf Object PDF
|
||||
* @param TCPDI $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Amount already paid (in the currency of invoice)
|
||||
* @param int $posy Position depart
|
||||
@ -1760,7 +1760,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param tcpdf $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -1820,7 +1820,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param Tcpdf $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -2141,7 +2141,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
@ -2157,8 +2157,8 @@ class pdf_sponge extends ModelePDFFactures
|
||||
/**
|
||||
* Define Array Column Field
|
||||
*
|
||||
* @param object $object common object
|
||||
* @param Translate $outputlangs langs
|
||||
* @param object $object common object
|
||||
* @param Translate $outputlangs langs
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
|
||||
@ -472,7 +472,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -536,7 +536,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -709,7 +709,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2008 Chiptronik
|
||||
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2020 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -627,7 +627,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
@ -656,7 +656,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -722,7 +722,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -896,7 +896,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -37,7 +37,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
/**
|
||||
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
|
||||
*
|
||||
* @param PDF $pdf PDF reference
|
||||
* @param TCPDF $pdf PDF reference
|
||||
* @param Translate $outputlangs Output langs
|
||||
* @param array $param Associative array containing label content and optional parameters
|
||||
* @return void
|
||||
@ -53,7 +53,7 @@ class pdf_standard extends CommonStickerGenerator
|
||||
* - __LOGO__ is replace with company logo
|
||||
* - __PHOTO__ is replace with photo provided as parameter
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param string $textleft Text left
|
||||
* @param string $header Header
|
||||
* @param string $footer Footer
|
||||
|
||||
@ -516,7 +516,7 @@ class pdf_baleine extends ModelePDFProjects
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -567,7 +567,7 @@ class pdf_baleine extends ModelePDFProjects
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Project $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -658,7 +658,7 @@ class pdf_baleine extends ModelePDFProjects
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Project $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -691,7 +691,7 @@ class pdf_beluga extends ModelePDFProjects
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -742,7 +742,7 @@ class pdf_beluga extends ModelePDFProjects
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Project $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -809,7 +809,7 @@ class pdf_beluga extends ModelePDFProjects
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Project $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -447,7 +447,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -498,7 +498,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Project $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -589,7 +589,7 @@ class pdf_timespent extends ModelePDFProjects
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Project $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -1023,7 +1023,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Propal $object Object propal
|
||||
* @param int $deja_regle Amount already paid
|
||||
* @param int $posy Start position
|
||||
@ -1297,7 +1297,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -1414,7 +1414,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1665,7 +1665,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
@ -1683,7 +1683,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
/**
|
||||
* Show area for the customer to sign
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
|
||||
@ -1145,7 +1145,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
@ -1432,7 +1432,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -1486,7 +1486,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1737,7 +1737,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
@ -1753,7 +1753,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
/**
|
||||
* Show area for the customer to sign
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
|
||||
@ -573,7 +573,7 @@ class pdf_squille extends ModelePdfReception
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
@ -675,7 +675,7 @@ class pdf_squille extends ModelePdfReception
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
@ -757,7 +757,7 @@ class pdf_squille extends ModelePdfReception
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1003,7 +1003,7 @@ class pdf_squille extends ModelePdfReception
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -617,7 +617,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object invoice
|
||||
* @param int $deja_regle Amount already paid (in the currency of invoice)
|
||||
* @param int $posy Position depart
|
||||
@ -843,7 +843,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -949,7 +949,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
/**
|
||||
* Show payments table
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
@ -1040,7 +1040,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param FactureFournisseur $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1252,7 +1252,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param FactureFournisseur $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -808,7 +808,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show payments table
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommandeFournisseur $object Object order
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
@ -824,7 +824,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommandeFournisseur $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
@ -890,7 +890,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
@ -1103,7 +1103,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -1176,7 +1176,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommandeFournisseur $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1416,7 +1416,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param CommandeFournisseur $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -693,7 +693,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show payments table
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommandeFournisseur $object Object order
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
@ -709,7 +709,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommandeFournisseur $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
@ -717,13 +717,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
*/
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
|
||||
{
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
@ -733,39 +732,36 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
$posxval = 52;
|
||||
|
||||
// Show payments conditions
|
||||
if (!empty($object->cond_reglement_code) || $object->cond_reglement)
|
||||
{
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
// Show payments conditions
|
||||
if (!empty($object->cond_reglement_code) || $object->cond_reglement_id) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions") . ':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) != ('PaymentCondition' . $object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_id);
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 3;
|
||||
}
|
||||
$posy = $pdf->GetY() + 3;
|
||||
}
|
||||
|
||||
// Show payment mode
|
||||
if (!empty($object->mode_reglement_code))
|
||||
{
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
// Show payment mode
|
||||
if (!empty($object->mode_reglement_code)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode") . ':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType" . $object->mode_reglement_code) != ('PaymentType' . $object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType" . $object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
|
||||
return $posy;
|
||||
}
|
||||
@ -775,7 +771,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
@ -988,7 +984,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -1094,7 +1090,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param CommandeFournisseur $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1174,7 +1170,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$langs->load("projects");
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1333,7 +1329,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param CommandeFournisseur $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -508,7 +508,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param PaiementFourn $object Object PaiementFourn
|
||||
* @param int $posy Position depart
|
||||
* @param Translate $outputlangs Objet langs
|
||||
@ -566,7 +566,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param integer $tab_top Top position of table
|
||||
* @param integer $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -611,7 +611,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param FactureFournisseur $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -789,7 +789,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param FactureFournisseur $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -691,7 +691,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
/**
|
||||
* Show payments table
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object proposal
|
||||
* @param int $posy Position y in PDF
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
@ -707,7 +707,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
@ -746,7 +746,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
//$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
$pdf->MultiCell(80, 4, '', 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
}
|
||||
@ -874,7 +874,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
/**
|
||||
* Show total to pay
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Facture $object Object invoice
|
||||
* @param int $deja_regle Montant deja regle
|
||||
* @param int $posy Position depart
|
||||
@ -1093,13 +1093,10 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
/*
|
||||
$resteapayer = $object->total_ttc - $deja_regle;
|
||||
if (! empty($object->paye)) $resteapayer=0;
|
||||
*/
|
||||
if (!empty($object->paye)) $resteapayer = 0;
|
||||
|
||||
if ($deja_regle > 0)
|
||||
{
|
||||
if ($deja_regle > 0) {
|
||||
$index++;
|
||||
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
@ -1145,7 +1142,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y (not used)
|
||||
@ -1251,7 +1248,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1463,7 +1460,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
* @param PDF $pdf PDF
|
||||
* @param TCPDF $pdf PDF
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
|
||||
@ -287,8 +287,8 @@ class Products extends DolibarrApi
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') { continue;
|
||||
}
|
||||
if ($field == 'stock_reel') {
|
||||
throw new RestException(400, 'Stock reel cannot be updated here. Use the /stockmovements endpoint instead');
|
||||
if ($field == 'stock_reel') {
|
||||
throw new RestException(400, 'Stock reel cannot be updated here. Use the /stockmovements endpoint instead');
|
||||
}
|
||||
$this->product->$field = $value;
|
||||
}
|
||||
@ -578,12 +578,12 @@ class Products extends DolibarrApi
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
$prodcustprice = new Productcustomerprice($this->db);
|
||||
$filter = array();
|
||||
$filter['t.fk_product'] .= $id;
|
||||
if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id;
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
$prodcustprice = new Productcustomerprice($this->db);
|
||||
$filter = array();
|
||||
$filter['t.fk_product'] .= $id;
|
||||
if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id;
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
}
|
||||
|
||||
if (empty($prodcustprice->lines)) {
|
||||
@ -624,8 +624,8 @@ class Products extends DolibarrApi
|
||||
}
|
||||
|
||||
return array(
|
||||
'prices_by_qty'=>$this->product->prices_by_qty[0], // 1 if price by quantity was activated for the product
|
||||
'prices_by_qty_list'=>$this->product->prices_by_qty_list[0]
|
||||
'prices_by_qty'=>$this->product->prices_by_qty[0], // 1 if price by quantity was activated for the product
|
||||
'prices_by_qty_list'=>$this->product->prices_by_qty_list[0]
|
||||
);
|
||||
}
|
||||
|
||||
@ -641,11 +641,11 @@ class Products extends DolibarrApi
|
||||
* @param string $ref_fourn Supplier ref
|
||||
* @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string)
|
||||
* @param string $charges costs affering to product
|
||||
* @param float $remise_percent Discount regarding qty (percent)
|
||||
* @param float $remise Discount regarding qty (amount)
|
||||
* @param int $newnpr Set NPR or not
|
||||
* @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined.
|
||||
* @param string $supplier_reputation Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER)
|
||||
* @param float $remise_percent Discount regarding qty (percent)
|
||||
* @param float $remise Discount regarding qty (amount)
|
||||
* @param int $newnpr Set NPR or not
|
||||
* @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined.
|
||||
* @param string $supplier_reputation Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER)
|
||||
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
|
||||
* @param string $newdefaultvatcode Default vat code
|
||||
* @param float $multicurrency_buyprice Purchase price for the quantity min in currency
|
||||
@ -749,77 +749,77 @@ class Products extends DolibarrApi
|
||||
*/
|
||||
public function getSupplierProducts($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $supplier = 0, $sqlfilters = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
$obj_ret = array();
|
||||
$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
|
||||
$sql = "SELECT t.rowid, t.ref, t.ref_ext";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as t";
|
||||
if ($category > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as c";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as s";
|
||||
global $db, $conf;
|
||||
$obj_ret = array();
|
||||
$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
|
||||
$sql = "SELECT t.rowid, t.ref, t.ref_ext";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as t";
|
||||
if ($category > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as c";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as s";
|
||||
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('product').')';
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('product').')';
|
||||
|
||||
if ($supplier > 0) {
|
||||
$sql .= " AND s.fk_soc = ".$db->escape($supplier);
|
||||
}
|
||||
$sql .= " AND s.fk_product = t.rowid";
|
||||
// Select products of given category
|
||||
if ($category > 0) {
|
||||
$sql .= " AND c.fk_categorie = ".$db->escape($category);
|
||||
$sql .= " AND c.fk_product = t.rowid";
|
||||
}
|
||||
if ($mode == 1) {
|
||||
// Show only products
|
||||
$sql .= " AND t.fk_product_type = 0";
|
||||
} elseif ($mode == 2) {
|
||||
// Show only services
|
||||
$sql .= " AND t.fk_product_type = 1";
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i = 0;
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
if ($supplier > 0) {
|
||||
$sql .= " AND s.fk_soc = ".$db->escape($supplier);
|
||||
}
|
||||
$sql .= " AND s.fk_product = t.rowid";
|
||||
// Select products of given category
|
||||
if ($category > 0) {
|
||||
$sql .= " AND c.fk_categorie = ".$db->escape($category);
|
||||
$sql .= " AND c.fk_product = t.rowid";
|
||||
}
|
||||
if ($mode == 1) {
|
||||
// Show only products
|
||||
$sql .= " AND t.fk_product_type = 0";
|
||||
} elseif ($mode == 2) {
|
||||
// Show only services
|
||||
$sql .= " AND t.fk_product_type = 1";
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i = 0;
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$product_fourn = new ProductFournisseur($this->db);
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($obj->rowid, '', '', 0, 0);
|
||||
foreach ($product_fourn_list as $tmpobj) {
|
||||
$this->_cleanObjectDatas($tmpobj);
|
||||
}
|
||||
$product_fourn = new ProductFournisseur($this->db);
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($obj->rowid, '', '', 0, 0);
|
||||
foreach ($product_fourn_list as $tmpobj) {
|
||||
$this->_cleanObjectDatas($tmpobj);
|
||||
}
|
||||
|
||||
//var_dump($product_fourn_list->db);exit;
|
||||
$obj_ret[$obj->rowid] = $product_fourn_list;
|
||||
//var_dump($product_fourn_list->db);exit;
|
||||
$obj_ret[$obj->rowid] = $product_fourn_list;
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror());
|
||||
}
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No product found');
|
||||
}
|
||||
return $obj_ret;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror());
|
||||
}
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No product found');
|
||||
}
|
||||
return $obj_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1057,7 +1057,7 @@ class Products extends DolibarrApi
|
||||
$result = $prodattr->delete(DolibarrApiAccess::$user);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, "Error deleting attribute");
|
||||
throw new RestException(500, "Error deleting attribute");
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -1161,9 +1161,23 @@ class Products extends DolibarrApi
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE ref LIKE '".trim($ref)."' AND fk_product_attribute = ".(int) $id;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE ref LIKE '".trim($ref)."' AND fk_product_attribute = ".(int) $id." AND entity IN (".getEntity('product').")";
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
if (!$query) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if (!$this->db->num_rows($query)) {
|
||||
throw new RestException(404, 'Attribute value not found');
|
||||
}
|
||||
|
||||
$result = $this->db->fetch_object($query);
|
||||
|
||||
$attrval = new ProductAttributeValue($this->db);
|
||||
$attrval->id = $result->rowid;
|
||||
$result = $attrval->delete(DolibarrApiAccess::$user);
|
||||
if ($result > 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1328,7 +1342,7 @@ class Products extends DolibarrApi
|
||||
$objectval = new ProductAttributeValue($this->db);
|
||||
$objectval->id = (int) $id;
|
||||
|
||||
if ($objectval->delete() > 0) {
|
||||
if ($objectval->delete(DolibarrApiAccess::$user) > 0) {
|
||||
return 1;
|
||||
}
|
||||
throw new RestException(500, "Error deleting attribute value");
|
||||
@ -1448,9 +1462,9 @@ class Products extends DolibarrApi
|
||||
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact, $reference);
|
||||
if ($result > 0)
|
||||
{
|
||||
return $result;
|
||||
return $result;
|
||||
} else {
|
||||
throw new RestException(500, "Error creating new product variant");
|
||||
throw new RestException(500, "Error creating new product variant");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1573,7 +1587,7 @@ class Products extends DolibarrApi
|
||||
$result = $prodcomb->delete(DolibarrApiAccess::$user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
throw new RestException(500, "Error deleting variant");
|
||||
throw new RestException(500, "Error deleting variant");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -1665,17 +1679,17 @@ class Products extends DolibarrApi
|
||||
}
|
||||
|
||||
if ($includestockdata) {
|
||||
$this->product->load_stock();
|
||||
$this->product->load_stock();
|
||||
|
||||
if (is_array($this->product->stock_warehouse)) {
|
||||
foreach ($this->product->stock_warehouse as $keytmp => $valtmp) {
|
||||
if (is_array($this->product->stock_warehouse[$keytmp]->detail_batch)) {
|
||||
foreach ($this->product->stock_warehouse[$keytmp]->detail_batch as $keytmp2 => $valtmp2) {
|
||||
unset($this->product->stock_warehouse[$keytmp]->detail_batch[$keytmp2]->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_array($this->product->stock_warehouse)) {
|
||||
foreach ($this->product->stock_warehouse as $keytmp => $valtmp) {
|
||||
if (is_array($this->product->stock_warehouse[$keytmp]->detail_batch)) {
|
||||
foreach ($this->product->stock_warehouse[$keytmp]->detail_batch as $keytmp2 => $valtmp2) {
|
||||
unset($this->product->stock_warehouse[$keytmp]->detail_batch[$keytmp2]->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($includesubproducts) {
|
||||
|
||||
@ -90,9 +90,9 @@ if ($confirm == 'yes') {
|
||||
if ($action == 'confirm_delete') {
|
||||
$db->begin();
|
||||
|
||||
$res = $objectval->deleteByFkAttribute($object->id);
|
||||
$res = $objectval->deleteByFkAttribute($object->id, $user);
|
||||
|
||||
if ($res < 1 || ($object->delete() < 1)) {
|
||||
if ($res < 1 || ($object->delete($user) < 1)) {
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), $object->errors, 'errors');
|
||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2));
|
||||
@ -105,7 +105,7 @@ if ($confirm == 'yes') {
|
||||
} elseif ($action == 'confirm_deletevalue')
|
||||
{
|
||||
if ($objectval->fetch($valueid) > 0) {
|
||||
if ($objectval->delete() < 1) {
|
||||
if ($objectval->delete($user) < 1) {
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), $objectval->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
|
||||
@ -16,17 +16,18 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
/**
|
||||
* Class ProductAttribute
|
||||
* Used to represent a product attribute
|
||||
*/
|
||||
class ProductAttribute
|
||||
class ProductAttribute extends CommonObject
|
||||
{
|
||||
/**
|
||||
* Database handler
|
||||
* @var DoliDB
|
||||
*/
|
||||
private $db;
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* Id of the product attribute
|
||||
@ -119,7 +120,8 @@ class ProductAttribute
|
||||
|
||||
$return[] = $tmp;
|
||||
}
|
||||
} else dol_print_error($this->db);
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
|
||||
return $return;
|
||||
}
|
||||
@ -127,11 +129,21 @@ class ProductAttribute
|
||||
/**
|
||||
* Creates a product attribute
|
||||
*
|
||||
* @param User $user Object user that create
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger Do not execute trigger
|
||||
* @return int <0 KO, Id of new variant if OK
|
||||
*/
|
||||
public function create(User $user)
|
||||
public function create(User $user, $notrigger = 0)
|
||||
{
|
||||
if (empty($notrigger)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('PRODUCT_ATTRIBUTE_CREATE', $user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
//Ref must be uppercase
|
||||
$this->ref = strtoupper($this->ref);
|
||||
|
||||
@ -152,11 +164,21 @@ class ProductAttribute
|
||||
/**
|
||||
* Updates a product attribute
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger Do not execute trigger
|
||||
* @return int <0 KO, >0 OK
|
||||
*/
|
||||
public function update(User $user)
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
if (empty($notrigger)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('PRODUCT_ATTRIBUTE_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
//Ref must be uppercase
|
||||
$this->ref = trim(strtoupper($this->ref));
|
||||
$this->label = trim($this->label);
|
||||
@ -173,11 +195,21 @@ class ProductAttribute
|
||||
/**
|
||||
* Deletes a product attribute
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return int <0 KO, >0 OK
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger Do not execute trigger
|
||||
* @return int <0 KO, >0 OK
|
||||
*/
|
||||
public function delete($user = null)
|
||||
public function delete(User $user, $notrigger = 0)
|
||||
{
|
||||
if (empty($notrigger)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('PRODUCT_ATTRIBUTE_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute WHERE rowid = ".(int) $this->id;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
|
||||
@ -16,17 +16,18 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
/**
|
||||
* Class ProductAttributeValue
|
||||
* Used to represent a product attribute value
|
||||
*/
|
||||
class ProductAttributeValue
|
||||
class ProductAttributeValue extends CommonObject
|
||||
{
|
||||
/**
|
||||
* Database handler
|
||||
* @var DoliDB
|
||||
*/
|
||||
private $db;
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* Attribute value id
|
||||
@ -144,10 +145,11 @@ class ProductAttributeValue
|
||||
/**
|
||||
* Creates a value for a product attribute
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return int <0 KO >0 OK
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger Do not execute trigger
|
||||
* @return int <0 KO >0 OK
|
||||
*/
|
||||
public function create(User $user)
|
||||
public function create(User $user, $notrigger = 0)
|
||||
{
|
||||
if (!$this->fk_product_attribute) {
|
||||
return -1;
|
||||
@ -155,15 +157,25 @@ class ProductAttributeValue
|
||||
|
||||
// Ref must be uppercase
|
||||
$this->ref = strtoupper($this->ref);
|
||||
$this->value = $this->db->escape($this->value);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_attribute_value (fk_product_attribute, ref, value, entity)
|
||||
VALUES ('".(int) $this->fk_product_attribute."', '".$this->db->escape($this->ref)."',
|
||||
'".$this->db->escape($this->value)."', ".(int) $this->entity.")";
|
||||
'".$this->value."', ".(int) $this->entity.")";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
if ($query) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'product_attribute_value');
|
||||
if (empty($notrigger)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('PRODUCT_ATTRIBUTE_VALUE_CREATE', $user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -173,11 +185,21 @@ class ProductAttributeValue
|
||||
/**
|
||||
* Updates a product attribute value
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger Do not execute trigger
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user)
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
if (empty($notrigger)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('PRODUCT_ATTRIBUTE_VALUE_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
//Ref must be uppercase
|
||||
$this->ref = trim(strtoupper($this->ref));
|
||||
$this->value = trim($this->value);
|
||||
@ -196,33 +218,62 @@ class ProductAttributeValue
|
||||
/**
|
||||
* Deletes a product attribute value
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $notrigger Do not execute trigger
|
||||
* @return int <0 KO, >0 OK
|
||||
*/
|
||||
public function delete()
|
||||
public function delete(User $user, $notrigger = 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE rowid = ".(int) $this->id;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
return 1;
|
||||
}
|
||||
if (empty($notrigger)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('PRODUCT_ATTRIBUTE_VALUE_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE rowid = ".(int) $this->id;
|
||||
if ($this->db->query($sql)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all product attribute values by a product attribute id
|
||||
*
|
||||
* @param int $fk_attribute Product attribute id
|
||||
* @param int $fk_attribute Product attribute id
|
||||
* @param User $user Object user
|
||||
* @return int <0 KO, >0 OK
|
||||
*/
|
||||
public function deleteByFkAttribute($fk_attribute)
|
||||
public function deleteByFkAttribute($fk_attribute, User $user)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE fk_product_attribute = ".(int) $fk_attribute;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product_attribute_value WHERE fk_product_attribute = ".(int) $fk_attribute;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
return 1;
|
||||
}
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return -1;
|
||||
if (!$query) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!$this->db->num_rows($query)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($query)) {
|
||||
$tmp = new ProductAttributeValue($this->db);
|
||||
if ($tmp->fetch($obj->rowid) > 0) {
|
||||
$result = $tmp->delete($user);
|
||||
if ($result < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user