Merge pull request #20 from Dolibarr/develop

pull from develop
This commit is contained in:
Tobias Sekan 2020-04-24 13:58:37 +02:00 committed by GitHub
commit e315435d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
108 changed files with 726 additions and 661 deletions

View File

@ -4,7 +4,7 @@ How to contribute to Dolibarr
Bug reports and feature requests
--------------------------------
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum).
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum).
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
@ -104,31 +104,32 @@ Long description (Can span accross multiple lines).
Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
a process to follow to optimize the chance to have PRs merged efficiently...
When submitting a pull request, use same rule as [Commits](#commits) for the message.
If your pull request only contains 1 commit, GitHub will be smart enough to fill it for you.
Otherwise, please be a bit verbose about what you're providing.
* A PR must be atomic. It means it must contains the lower possible changes for 1 need (1 bug fix or 1 new feature) without breaking usability of code. If a PR can be split into several PRs, it often means your PR is not atomic.
* Your Pull Request (PR) must pass the Continuous Integration checks and code quality checks.
* When submitting a pull request, use same rule as [Commits](#commits) for the message. If your pull request only contains 1 commit, GitHub will be smart enough to fill it for you. Otherwise, please be a bit verbose about what you're providing.
Your Pull Request (PR) must pass the Continuous Integration checks and code quality checks.
Also, some code changes need a prior approbation:
* if you want to include a new external library (into htdocs/includes directory), please ask before to the project manager (@eldy) to see if such a library can be accepted.
* if you want to include a new external library (into htdocs/includes directory), please ask before to the core project manager (mention @dolibarr-yoda in your issue) to see if such a library can be accepted.
* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@eldy) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest.
* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@dolibarr-yoda) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest.
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case).
If the label of PR start with "WIP" (Work In Progress), it will not be analyzed (until you change the label of PR).
If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of PR (but it can be analyzed for discussion).
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag ask you. The majority of open PR are waiting an action of the author of the PR.
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. Average answer delay is also one of the best among Open source project (just few days before having the Answer Tag set). This is one of the most important ratio of answered PR in Open Source world for a major project. Don't expect the core team to reach the 100%. A so high ratio is very rare on a so popular project and with the increasing popularity of Dolibarr, this ratio will probably decrease in future to a more common level.
Statistics on Dolibarr project shows that 95% of submitted PR are reviewed and tagged. Average answer delay is also one of the best among Open source projects (just few days before having the Answer Tag set). This is one of the most important ratio of answered PR in Open Source world for a major project. Don't expect the core team to reach the 100%. A so high ratio is very rare on a so popular project and with the increasing popularity of Dolibarr, this ratio will probably decrease in future to a more common level.
### Resources
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
[Developer documentation](https://wiki.dolibarr.org/index.php/Developer_documentation)
Translations
------------
@ -144,11 +145,11 @@ to retreive all old translation of a source text, and restore the translation in
### Resources
[Translator documentation](http://wiki.dolibarr.org/index.php/Translator_documentation)
[Translator documentation](https://wiki.dolibarr.org/index.php/Translator_documentation)
Documentation
-------------
The project's documentation is maintained on the [Wiki](http://wiki.dolibarr.org/index.php).
The project's documentation is maintained on the [Wiki](https://wiki.dolibarr.org/index.php).
*Note*: to help prevent spam, you need to create an account before being able to edit. Everybody is welcome to contribute to its content.

View File

@ -5,7 +5,7 @@
Dolibarr ERP & CRM is a modern software package to 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 freelances.
It's an Open Source Software (written in PHP language) 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.
@ -27,7 +27,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
- DoliWamp for Windows
- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp)
- DoliDeb for Debian or Ubuntu
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
@ -67,6 +67,7 @@ You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL)
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
## UPGRADING
- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr
@ -85,28 +86,27 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
### Main application/modules (all optional)
- Customers, Prospects (Leads) and/or Suppliers directory
- Customers, Prospects (Leads) and/or Suppliers directory + Contacts
- Members management
- Products and/or Services catalog
- Commercial proposals management
- Customer and Supplier Orders management
- Customer & Supplier Orders management
- Shipping management
- Warehouse/Stock management
- Invoices and payment management
- Standing orders management (European SEPA)
- Bank accounts management
- Accounting management
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Opportunities and/or project management
- Projects management
- Projects & Tasks management
- Contracts management
- Warehouse/Stock management
- Shipping management
- Interventions management
- Employee's leave requests management
- Expense reports
- Timesheets
- Electronic Document Management (EDM)
- Foundations members management
- Mass emailing
- Surveys
- Point of Sale (POS)
- …
@ -115,11 +115,13 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Bookmarks management
- Donations management
- Reporting
- Surveys
- Data export/import
- Barcodes support
- Margin calculations
- LDAP connectivity
- ClickToDial integration
- Mass emailing
- RSS integration
- Skype integration
- Payment platforms integration (PayPal, Stripe, Paybox...)

View File

@ -1,45 +1,47 @@
[CustomMessages]
NameAndVersion=%1 versió %2
NameAndVersion=%1 versió %2
AdditionalIcons=Icones addicionals:
CreateDesktopIcon=Crea una icona a l'&Escriptori
CreateQuickLaunchIcon=Crea una icona a la &Barra de tasques
ProgramOnTheWeb=%1 a Internet
UninstallProgram=Desinstal·la %1
UninstallProgram=Desinstal·la %1
LaunchProgram=Obre %1
AssocFileExtension=&Associa %1 amb l'extensió de fitxer %2
AssocingFileExtension=Associant %1 amb l'extensió de fitxer %2...
AssocFileExtension=&Associa %1 amb l'extensió de fitxer %2
AssocingFileExtension=Associant %1 amb l'extensió de fitxer %2...
YouWillInstallDoliWamp=Va a instal·lar o actualitzar (Apache + Mysql + PHP + Dolibarr) al seu ordinador.
ThisAssistantInstallOrUpgrade=Aquest assistent instal·la o actualitza Dolibarr ERP-CRM i tots els seus requisits (Apache, Mysql i PHP) optimitzats per a l'ús de Dolibarr.
IfYouHaveTechnicalKnowledge=Si teniu coneixements tècnics i necessita usar la seva Apache, Mysql i PHP amb altres aplicacions a part de Dolibarr, no utilitzeu aquest assistent, hauria lació manual d'Dolibarr sobre un Apache, Mysql i PHP existent.
ButIfYouLook=Però si busca una instal·lació automàtica, es troba en el bon camí...
DoYouWantToStart=Vol iniciar el procés d'instal·lació/actualització?
YouWillInstallDoliWamp=Instal·laràs DoliWamp (Dolibarr i altres programaris com Apache, Mysql i PHP) al teu ordinador.
ThisAssistantInstallOrUpgrade=ALERTA: Utilitzar un ERP CRM instal·lat en un ordinador en local pot ser perillós: si l'ordinador s'espatlla, pots perdre totes les teves dades. Fes-ho si estàs preparat per autogestionar-te còpies de seguretat. Si no, pots utilitzar una instal·lació Saas (pots veure https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Si tens coneixements tècnics i vols autogestionar el teu Apache, Mysql i PHP, no utilitzis aquest assistent i fes una instal·lació manual de Dolibarr sobre un servidor existent d'Apache, Mysql i PHP.
ButIfYouLook=Però si busques una instal·lació automàtica en el teu propi ordinador, et trobes en el bon camí...
DoYouWantToStart=Vols iniciar el procés d'instal·lació?
TechnicalParameters=Paràmetres tècnics
IfFirstInstall=Si es tracta de la primera instal lació, haurà d'especificar alguns paràmetres tècnics. Si no els entén, no sabeu o va a procedir a una actualització, deixi els camps amb els valors proposats per defecte.
TechnicalParameters=Paràmetres tècnics
IfFirstInstall=Si es tracta de la primera instal·lació, hauràs d'especificar alguns paràmetres tècnics. Si no els entens, no n'estàs segur, o estàs fent una actualització, pots deixar els valors per defecte.
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 70 CHARACTERS
SMTPServer=Servidor SMTP (El seu o el del seu ISP, únicament primera instal.lació) :
ApachePort=Puerto Apache (únicament primera instal.lació, normalment és el 80) :
MySqlPort=Puerto Mysql (únicament primera instal.lació, normalment és el 3306) :
MySqlPassword=Contrasenya del servidor i la base de dades MySQL de root (únicament primera instal.lació):
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=Servidor SMTP (propi o ISP, només primera instal·lació) :
ApachePort=Port Apache (només primera instal·lació, normalment el 80) :
MySqlPort=Port MySql (només primera instal·lació, normalment el 3306) :
MySqlPassword=Contrasenya del servidor i base de dades MySql de root (només primera instal·lació):
FailedToDeleteLock=FailedToDeleteLock=Error en l'eliminació del fitxer %1/www/dolibarr/install.lock. Pot ignorar l'avís però és possible que hagi de eliminar-lo manualment més tard. En aquest cas, serà informat. Feu clic a OK per continuar...
FailedToDeleteLock=FailedToDeleteLock=Error en l'eliminació del fitxer %1/www/dolibarr/install.lock. Pots ignorar l'avís però és possible que hagis d'eliminar-lo manualment més tard. En aquest cas, serà informat. Fes clic a OK per continuar...
PortAlreadyInUse=Sembla que el port %1 ja està sent utilitzat. Es recomana cancel·lar, tornar enrere i especificar un altre valor per al port% 2. Cancel·lar i escollir un altre valor?
PortAlreadyInUse=Sembla que el port %1 ja està sent utilitzat. Es recomana cancel·lar, tornar enrere i especificar un altre valor per al port% 2. Vols cancel·lar i escollir un altre valor?
FirefoxDetected=S'ha detectat Firefox al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr?
ChromeDetected=S'ha detectat Chrome al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr?
ChooseDefaultBrowser=Esculli el seu navegador per defecte. Si no està segur, simplement feu clic a Obrir:
FirefoxDetected=S'ha detectat Firefox al teu ordinador. El vols utilitzar com a navegador per defecte per Dolibarr?
ChromeDetected=S'ha detectat Chrome al teu ordinador. El vols utilitzar com a navegador per defecte per Dolibarr?
ChooseDefaultBrowser=Escull el teu navegador per defecte (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...).. Si no estàs segur, simplement fes clic a Obre:
LaunchNow=Llançar ara Dolibarr
LaunchNow=Obre ara el Dolibarr
ProgramHasBeenRemoved=Els arxius del programa Dolibarr han estat eliminats. No obstant això tots els seus arxius de dades es troben encara al directori %1. Haurà eliminar aquest directori manualment per a una desinstal completa.
ProgramHasBeenRemoved=Els arxius del programa Dolibarr han estat eliminats. No obstant això tots els seus arxius de dades es troben encara al directori %1. Hauràs d'eliminar aquest directori manualment per a una desinstal·lació completa.
DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reiniciar Apache i MySQL, això pot durar des de diversos segons a un minut després de la confirmació. Iniciar la instal·lació o actualització dels servidors web i bases de dades requerides per Dolibarr?
DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reiniciar Apache i MySQL, això pot durar des de diversos segons a un minut després de la confirmació. Vols iniciar la instal·lació o actualització dels servidors web i de base de dades requerides per Dolibarr?
OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr
OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr
OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr
OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr
DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp.
ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit)

View File

@ -1,45 +1,47 @@
[CustomMessages]
NameAndVersion=%1 versión %2
NameAndVersion=%1 versión %2
AdditionalIcons=Iconos adicionales:
CreateDesktopIcon=Crear un icono en el &escritorio
CreateQuickLaunchIcon=Crear un icono de Inicio Rápido
CreateQuickLaunchIcon=Crear un icono de Inicio Rápido
ProgramOnTheWeb=%1 en la Web
UninstallProgram=Desinstalar %1
LaunchProgram=Ejecutar %1
AssocFileExtension=&Asociar %1 con la extensión de archivo %2
AssocingFileExtension=Asociando %1 con la extensión de archivo %2...
AssocFileExtension=&Asociar %1 con la extensión de archivo %2
AssocingFileExtension=Asociando %1 con la extensión de archivo %2...
YouWillInstallDoliWamp=Va a instalar o actualizar (Apache+Mysql+PHP+Dolibarr) en su ordenador.
ThisAssistantInstallOrUpgrade=Este asistente instala o actualiza Dolibarr ERP-CRM y todos sus requisitos (Apache, Mysql y PHP) optimizados para el uso de Dolibarr.
IfYouHaveTechnicalKnowledge=Si tiene conocimientos técnicos y necesita usar su Apache, Mysql y PHP con otras aplicaciones aparte de Dolibarr, no debería usar este asistente, debería realizar una instalación manual de Dolibarr sobre un Apache, Mysql y PHP existente.
ButIfYouLook=Pero si busca una instalación automática, se encuentra en el buen camino...
DoYouWantToStart=¿Quiere iniciar el proceso de instalación/actualización?
YouWillInstallDoliWamp=Va a instalar DoliWamp (Dolibarr y otro software como Apache, Mysql y PHP) en su ordenador.
ThisAssistantInstallOrUpgrade=ALERTA: Utilizar un ERP CRM instalado en un ordenador en local puede ser peligroso: si el ordenador se estropea, puede perder todos sus datos. Hágalo si está preparado para autogestionar sus copias de seguridad. Si no, puede utilizar una instalacion Saas (puede ver https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Si tiene conocimientos técnicos y necesita usar su Apache, Mysql y PHP con otras aplicaciones aparte de Dolibarr, no debería usar este asistente, debería realizar una instalación manual de Dolibarr sobre un Apache, Mysql y PHP existente.
ButIfYouLook=Pero si busca una instalación automática en tu propio ordenador, se encuentra en el buen camino...
DoYouWantToStart=¿Quiere iniciar el proceso de instalación?
TechnicalParameters=Parámetros técnicos
IfFirstInstall=Si se trata de la primera instalación, deberá especificar algunos parámetros técnicos. Si no los entiende, no está seguro o va a proceder a una actualización, deje los campos con los valores propuestos por defecto.
TechnicalParameters=Parámetros técnicos
IfFirstInstall=Si se trata de la primera instalación, deberá especificar algunos parámetros técnicos. Si no los entiende, no está seguro o va a proceder a una actualización, deje los campos con los valores propuestos por defecto.
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 70 CHARACTERS
SMTPServer=Servidor SMTP (El suyo o el de su ISP, únicamente primera instalación) :
ApachePort=Puerto Apache (únicamente primera instalación, normalmente es el 80) :
MySqlPort=Puerto Mysql (únicamente primera instalación, normalmente es el 3306) :
MySqlPassword=Contraseña del servidor y la base de datos MySQL de root (únicamente primera instalación):
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=Servidor SMTP (propio o su ISP, sólo primera instalación) :
ApachePort=Puerto Apache (sólo primera instalación, normalmente el 80) :
MySqlPort=Puerto Mysql (sólo primera instalación, normalmente el 3306) :
MySqlPassword=Contraseña del servidor y la base de datos MySQL de root (sólo primera instalación):
FailedToDeleteLock=Error en la eliminación del archivo %1/www/dolibarr/install.lock. Puede ignorar el aviso pero es posible que deba eliminarlo manualmente más tarde. En este caso, será informado. Haga clic en OK para continuar...
FailedToDeleteLock=Error en la eliminación del archivo %1/www/dolibarr/install.lock. Puede ignorar el aviso pero es posible que deba eliminarlo manualmente más tarde. En este caso, será informado. Haga clic en OK para continuar...
PortAlreadyInUse=Parece que el puerto %1 ya esta siendo usado. Se recomienda cancelar, volver atras y especificar otro valor para el puerto %2. ¿Cancelar y escojer otro valor?
PortAlreadyInUse=Parece que el puerto %1 ya esta siendo usado. Se recomienda cancelar, volver atras y especificar otro valor para el puerto %2. ¿Cancelar y escojer otro valor?
FirefoxDetected=Se ha detectado Firefox en su ordenador. Desea activarlo por defecto como navegador para Dolibarr ?
ChromeDetected=Se ha detectado Chrome en su ordenador. Desea activarlo por defecto como navegador para Dolibarr ?
ChooseDefaultBrowser=Escoja su navegador por defecto. Si no está seguro, simplementa haga clic en Abrir :
ChooseDefaultBrowser=Escoja su navegador por defecto (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). Si no está seguro, simplementa haga clic en Abrir :
LaunchNow=Lanzar ahora Dolibarr
ProgramHasBeenRemoved=Los archivos del programa Dolibarr han sido eliminados. Sin embargo todos sus archivos de datos se encuentran todavía en el directorio %1. Deberá eliminar este directorio manualmente para una desinstalación completa.
ProgramHasBeenRemoved=Los archivos del programa Dolibarr han sido eliminados. Sin embargo todos sus archivos de datos se encuentran todavía en el directorio %1. Deberá eliminar este directorio manualmente para una desinstalación completa.
DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reiniciar Apache y MySQL, esto puede durar desde varios segundos a un minuto después de la confirmación. ¿Iniciar la instalación o actualización de los servidores Web y bases de datos requeridas por Dolibarr?
DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reiniciar Apache y MySQL, esto puede durar desde varios segundos a un minuto después de la confirmación. ¿Iniciar la instalación o actualización de los servidores Web y bases de datos requeridas por Dolibarr?
OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr
OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr
OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr
OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr
DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp.
ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito)

View File

@ -657,7 +657,7 @@ class Adherent extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0) {
@ -927,14 +927,11 @@ class Adherent extends CommonObject
// Removed extrafields
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}

View File

@ -409,7 +409,7 @@ class AdherentType extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -128,7 +128,7 @@ print '<input name="town" class="minwidth100" id="town" value="'.($conf->global-
// Country
print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n";

View File

@ -429,7 +429,7 @@ print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SO
// Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($mysoc->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n";

View File

@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
if (! $user->admin) accessforbidden();
if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type='invoice';
$type = 'invoice';
/*
@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
* View
*/
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(
"", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
);
$form=new Form($db);
$form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
$head = invoice_admin_prepare_head();
@ -106,12 +106,12 @@ $arrayAvailableType = array(
);
$selected = array();
$implodeglue = '+';
if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){
if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) {
$selected = explode('+', $conf->global->{$confkey});
}
$curentInput = (empty($inputCount)?1:($inputCount+1));
$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1);
$curentInput = (empty($inputCount) ? 1 : ($inputCount + 1));
$formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1);
_printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType);
//_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation'));
@ -126,7 +126,7 @@ $metas = array(
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
// Conditions paiements
$inputCount = empty($inputCount)?1:($inputCount+1);
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
print '<tr class="oddeven">';
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
print '<td class="center" width="20">&nbsp;</td>';
@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '')
global $langs;
print '<tr class="oddeven">';
print '<td>'.($title?$title:$langs->trans($confkey));
print '<td>'.($title ? $title : $langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
@ -206,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
{
global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount)?1:($inputCount+1);
$form=new Form($db);
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
if ($type!='textarea') {
if ($type != 'textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
@ -229,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<td>';
if (!empty($help)) {
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else {
print $title?$title:$langs->trans($confkey);
print $title ? $title : $langs->trans($confkey);
}
if (!empty($desc)) {
@ -244,12 +244,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type=='textarea') {
if ($type == 'textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
}elseif($type=='input'){
}elseif ($type == 'input') {
print '<input '.$metascompil.' />';
}
else{
else {
// custom
print $type;
}

View File

@ -209,6 +209,8 @@ else
// Show examples
print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
print '<span class="opacitymedium">'.$langs->trans("Format").':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
// Always show vat rates with vat 0
$s = 2 / 7; $qty = 1; $vat = 0;
$tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);

View File

@ -281,8 +281,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).'</td>'."\n";
print '<td class="right">';
print '<textarea id="response" class="hideobject" name="response"></textarea>';
print '<input type="submit" name="modify_apilayer" class="button" value="'.$langs->trans("Modify").'">';
print '<input type="submit" id="bt_sync" name="bt_sync_apilayer" class="button" value="'.$langs->trans('Synchronize').'" />';
print '<input type="submit" name="modify_apilayer" class="button buttongen" value="'.$langs->trans("Modify").'">';
print '<input type="submit" id="bt_sync" name="bt_sync_apilayer" class="button buttongen" value="'.$langs->trans('Synchronize').'" />';
print '</td></tr>';
print '<tr class="oddeven">';

View File

@ -153,7 +153,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
// Show message
$message = '';
$url = $urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
$message .= $langs->trans("UrlToGetKeyToUseAPIs").':<br>';
$message .= '<span class="opacitymedium">'.$langs->trans("UrlToGetKeyToUseAPIs").':</span><br>';
$message .= img_picto('', 'globe').' '.$url;
print $message;
print '<br>';

View File

@ -1409,15 +1409,15 @@ class Setup extends DolibarrApi
*
* Note that conf variables that stores security key or password hashes can't be loaded with API.
*
* @url GET /conf
*
* @param string $confname Name of conf variable to get
* @param string $constantname Name of conf variable to get
* @return array|mixed Data without useless information
*
* @url GET conf/{constantname}
*
* @throws RestException 403 Forbidden
* @throws RestException 500 Error Bad or unknown value for constname
* @throws RestException 500 Error Bad or unknown value for constantname
*/
public function getConf($confname)
public function getConf($constantname)
{
global $conf;
@ -1426,14 +1426,14 @@ class Setup extends DolibarrApi
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
}
if (!preg_match('/^[a-zA-Z0-9_]+$/', $confname) || !isset($conf->global->$confname)) {
throw new RestException(500, 'Error Bad or unknown value for constname');
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || ! isset($conf->global->$constantname)) {
throw new RestException(500, 'Error Bad or unknown value for constantname');
}
if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) {
if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) {
throw new RestException(403, 'Forbidden');
}
return $conf->global->$confname;
return $conf->global->$constantname;
}
/**

View File

@ -202,7 +202,7 @@ class AssetType extends CommonObject
$action = 'update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -128,12 +128,16 @@ $coldisplay++;
print '<td class="nobottom nowrap linecollost right">';
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
$coldisplay++;
print '<td class="nobottom nowrap linecolcostprice right">';
print '</td>';
$coldisplay += $colspan;
print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
$coldisplay += $colspan;
print '<input type="submit" class="button" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button buttongen marginbottomonly" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
print '<br>';
print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button buttongen marginbottomonly" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '</tr>';

View File

@ -52,7 +52,7 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum c
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
// Qty
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';
if ($conf->global->PRODUCT_USE_UNITS)
{

View File

@ -461,7 +461,7 @@ class Categorie extends CommonObject
$action = 'create';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -553,7 +553,7 @@ class Categorie extends CommonObject
$action = 'update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -646,7 +646,7 @@ class Categorie extends CommonObject
}
// Removed extrafields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)

View File

@ -317,7 +317,7 @@ if (empty($reshook) && $action == 'add')
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby", "int");
}
$object->note = trim(GETPOST("note"));
$object->note_private = trim(GETPOST("note"));
if (isset($_POST["contactid"])) $object->contact = $contact;
@ -465,7 +465,6 @@ if (empty($reshook) && $action == 'update')
$object->contactid = key($object->socpeopleassigned);
}
$object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", "none"); // deprecated
$object->note_private = GETPOST("note", "none");
$object->fk_element = GETPOST("fk_element", "int");
$object->elementtype = GETPOST("elementtype", "alphanohtml");
@ -1122,7 +1121,7 @@ if ($action == 'create')
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
$doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>';
@ -1188,7 +1187,7 @@ if ($id > 0)
$object->contactid = GETPOST("contactid", 'int');
$object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", 'none');
$object_private = GETPOST("note", 'none');
}
if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
@ -1540,7 +1539,7 @@ if ($id > 0)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -380,7 +380,7 @@ class ActionComm extends CommonObject
// Clean parameters
$this->label = dol_trunc(trim($this->label), 128);
$this->location = dol_trunc(trim($this->location), 128);
$this->note = dol_htmlcleanlastbr(trim($this->note));
$this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private));
if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
if (empty($this->fulldayevent)) $this->fulldayevent = 0;
@ -488,7 +488,7 @@ class ActionComm extends CommonObject
$sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", ";
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
$sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', ";
$sql .= " '".$this->db->escape($this->note_private)."', ";
$sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", ";
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
@ -567,14 +567,11 @@ class ActionComm extends CommonObject
if (!$error)
{
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (!$error && !$notrigger)
@ -733,14 +730,14 @@ class ActionComm extends CommonObject
$this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : '');
$this->code = $obj->code;
$this->label = $obj->label;
$this->datep = $this->db->jdate($obj->datep);
$this->datef = $this->db->jdate($obj->datep2);
$this->label = $obj->label;
$this->datep = $this->db->jdate($obj->datep);
$this->datef = $this->db->jdate($obj->datep2);
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem);
$this->note = $obj->note;
$this->note = $obj->note; // deprecated
$this->note_private = $obj->note;
$this->percentage = $obj->percentage;
@ -993,7 +990,7 @@ class ActionComm extends CommonObject
// Clean parameters
$this->label = trim($this->label);
$this->note = trim($this->note);
$this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private));
if (empty($this->percentage)) $this->percentage = 0;
if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0;
if (empty($this->transparency)) $this->transparency = 0;
@ -1027,7 +1024,7 @@ class ActionComm extends CommonObject
$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
$sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated
$sql .= ", note = '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."'";
$sql .= ", note = '".$this->db->escape($this->note_private)."'";
$sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null");
$sql .= ", fk_soc =".($socid > 0 ? $socid : "null");
$sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null");
@ -1048,7 +1045,7 @@ class ActionComm extends CommonObject
$action = 'update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1406,8 +1403,8 @@ class ActionComm extends CommonObject
$tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype;
if (!empty($this->location))
$tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location;
if (!empty($this->note))
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note) ? str_replace(array("\r", "\n"), "", $this->note) : str_replace(array("\r", "\n"), '<br>', $this->note));
if (!empty($this->note_private))
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '<br>', $this->note_private));
$linkclose = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
$linkclose = ' style="background-color:#'.$this->type_color.'"';
@ -1940,8 +1937,7 @@ class ActionComm extends CommonObject
$this->location = 'Location';
$this->transparency = 1; // 1 means opaque
$this->priority = 1;
$this->note = "This is a 'public' note";
$this->note_public = "This is a 'public' note.";
//$this->note_public = "This is a 'public' note.";
$this->note_private = "This is a 'private' note.";
$this->userownerid = $user->id;

View File

@ -553,8 +553,7 @@ if ($resql)
$actionstatic->type_picto = $obj->type_picto;
$actionstatic->label = $obj->label;
$actionstatic->location = $obj->location;
$actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated
$actionstatic->note_public = dol_htmlentitiesbr($obj->note);
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
$actionstatic->fetchResources();
@ -613,8 +612,8 @@ if ($resql)
// Description
if (!empty($arrayfields['a.note']['checked'])) {
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note, 0));
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note);
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
print '</td>';
}

View File

@ -511,7 +511,7 @@ if (empty($reshook))
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -1253,13 +1253,10 @@ class Propal extends CommonObject
// Actions on extra fields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0)
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
@ -1683,7 +1680,7 @@ class Propal extends CommonObject
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3053,15 +3050,12 @@ class Propal extends CommonObject
// Removed extrafields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result = $this->deleteExtraFields();
if ($result < 0)
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}
@ -4152,7 +4146,7 @@ class PropaleLigne extends CommonObjectLine
{
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->insertExtraFields();
@ -4204,7 +4198,7 @@ class PropaleLigne extends CommonObjectLine
if ($this->db->query($sql))
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->deleteExtraFields();
@ -4334,7 +4328,7 @@ class PropaleLigne extends CommonObjectLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->insertExtraFields();

View File

@ -384,7 +384,7 @@ if (empty($reshook))
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
{
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;

View File

@ -3342,7 +3342,7 @@ class Commande extends CommonOrder
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3437,14 +3437,11 @@ class Commande extends CommonOrder
if (!$error)
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
$result = $this->deleteExtraFields();
if ($result < 0)
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
@ -4255,7 +4252,7 @@ class OrderLine extends CommonOrderLine
if ($resql)
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->deleteExtraFields();
@ -4401,7 +4398,7 @@ class OrderLine extends CommonOrderLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet');
$this->rowid = $this->id;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -4534,7 +4531,7 @@ class OrderLine extends CommonOrderLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->insertExtraFields();

View File

@ -285,7 +285,7 @@ if (($action == 'create' || $action == 'add') && !$error)
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -823,13 +823,10 @@ class Account extends CommonObject
if ($result)
{
// Actions on extra fields (by external module or standard code)
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0) $error++;
}
$result = $this->insertExtraFields();
if ($result < 0) $error++;
}
if (!$error && !$notrigger)
@ -1107,7 +1104,7 @@ class Account extends CommonObject
if ($result)
{
// Remove extrafields
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)

View File

@ -78,7 +78,7 @@ class BankAccounts extends DolibarrApi
$sql .= ' WHERE t.entity IN ('.getEntity('bank_account').')';
// Select accounts of given category
if ($category > 0) {
$sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_account = t.rowid ";
$sql .= " AND c.fk_categorie = ".$this->db->escape($category)." AND c.fk_account = t.rowid ";
}
// Add sql filters
if ($sqlfilters)

View File

@ -140,8 +140,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
// retained warranty invoice available type
$retainedWarrantyInvoiceAvailableType=array();
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$retainedWarrantyInvoiceAvailableType = array();
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
}
@ -952,7 +952,7 @@ if (empty($reshook))
}
$discount->tva_tx = abs($tva_tx);
$discount->vat_src_code =$vat_src_code;
$discount->vat_src_code = $vat_src_code;
$result = $discount->create($user);
if ($result < 0)
@ -1146,7 +1146,7 @@ if (empty($reshook))
foreach ($facture_source->lines as $line)
{
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) {
if (method_exists($line, 'fetch_optionals')) {
// load extrafields
$line->fetch_optionals();
}
@ -1362,11 +1362,11 @@ if (empty($reshook))
$object->situation_cycle_ref = $object->newCycle();
}
if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){
if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) {
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
else{
else {
$object->retained_warranty = 0;
$object->retained_warranty_fk_cond_reglement = 0;
}
@ -1644,7 +1644,7 @@ if (empty($reshook))
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@ -1772,15 +1772,15 @@ if (empty($reshook))
$object->origin_id = $originid;
// retained warranty
if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY))
{
$retained_warranty = GETPOST('retained_warranty', 'int');
if(price2num($retained_warranty) > 0)
if (price2num($retained_warranty) > 0)
{
$object->retained_warranty = price2num($retained_warranty);
$object->retained_warranty = price2num($retained_warranty);
}
if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
if (GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0)
{
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
}
@ -2629,10 +2629,10 @@ if (empty($reshook))
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
if($object->type == Facture::TYPE_SITUATION){
if ($object->type == Facture::TYPE_SITUATION) {
$situation_percent = 0;
}
else{
else {
$situation_percent = 100;
}
$fk_prev_id = '';
@ -3393,19 +3393,19 @@ if ($action == 'create')
print '</td></tr>';
if($conf->global->INVOICE_USE_RETAINED_WARRANTY){
if ($conf->global->INVOICE_USE_RETAINED_WARRANTY) {
$rwStyle = 'display:none;';
if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){
if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) {
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
if(empty($retained_warranty)){
if(!empty($objectsrc->retained_warranty)){ // use previous situation value
if (empty($retained_warranty)) {
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
}
}
$retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
$retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
@ -3413,11 +3413,11 @@ if ($action == 'create')
// Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
if(empty($retained_warranty_fk_cond_reglement)){
if (empty($retained_warranty_fk_cond_reglement)) {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
}else{
} else {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}

View File

@ -342,7 +342,7 @@ class FactureRec extends CommonInvoice
if ($objectline->fetch($result_insert))
{
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($facsrc->lines[$i], 'fetch_optionals')) {
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
$objectline->array_options = $facsrc->lines[$i]->array_options;
}
@ -438,7 +438,7 @@ class FactureRec extends CommonInvoice
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -2112,7 +2112,7 @@ class FactureLigneRec extends CommonInvoiceLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -813,12 +813,12 @@ class Facture extends CommonInvoice
$vatrate = $line->tva_tx;
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid=$line->origin_id;
$origintype=$line->origin;
if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
$originid = $line->origin_id;
$origintype = $line->origin;
} else {
$originid=$line->id;
$origintype=$this->element;
$originid = $line->id;
$origintype = $this->element;
}
$result = $this->addline(
@ -1452,9 +1452,10 @@ class Facture extends CommonInvoice
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
if ($txttoshow)
{
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
//$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
$result .= ' <span class="note inline-block">';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow, 1, 1).'">';
$result .= img_picto('', 'note');
$result .= '</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
@ -1881,7 +1882,7 @@ class Facture extends CommonInvoice
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3733,44 +3734,44 @@ class Facture extends CommonInvoice
}
if (!empty($addon)) {
dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG);
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
$mybool = false;
$file = $addon . '.php';
$file = $addon.'.php';
$classname = $addon;
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');
$dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/');
// Load file with numbering class (if found)
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
}
}
// For compatibility
if (!$mybool) {
$file = $addon . '/' . $addon . '.modules.php';
$classname = 'mod_' . $moduleName . '_' . $addon;
$file = $addon.'/'.$addon.'.modules.php';
$classname = 'mod_'.$moduleName.'_'.$addon;
$classname = preg_replace('/\-.*$/', '', $classname);
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot) {
$dir = $dirroot . '/core/modules/' . $moduleName . '/';
$dir = $dirroot.'/core/modules/'.$moduleName.'/';
// Load file with numbering class (if found)
if (is_file($dir . $file) && is_readable($dir . $file)) {
$mybool |= include_once $dir . $file;
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir.$file;
}
}
}
if (!$mybool) {
dol_print_error('', 'Failed to include file ' . $file);
dol_print_error('', 'Failed to include file '.$file);
return '';
}
@ -3789,7 +3790,7 @@ class Facture extends CommonInvoice
return $numref;
} else {
$langs->load('errors');
print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName));
return '';
}
}
@ -4755,7 +4756,7 @@ class Facture extends CommonInvoice
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
$displayWarranty = false;
if(!empty($this->retained_warranty)) {
if (!empty($this->retained_warranty)) {
$displayWarranty = true;
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) {
@ -4794,7 +4795,7 @@ class Facture extends CommonInvoice
$retainedWarrantyAmount = 0;
// Billed - retained warranty
if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION))
{
$displayWarranty = true;
// Check if this situation invoice is 100% for real
@ -4834,7 +4835,7 @@ class Facture extends CommonInvoice
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
}
if($rounding>0){
if ($rounding > 0) {
return round($retainedWarrantyAmount, $rounding);
}
@ -5237,7 +5238,7 @@ class FactureLigne extends CommonInvoiceLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
$this->rowid = $this->id; // For backward compatibility
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -5423,7 +5424,7 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->insertExtraFields();

View File

@ -691,6 +691,7 @@ else
// Country
print '<tr><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country((GETPOST("country_id", 'alpha') ? GETPOST("country_id", 'alpha') : $object->country_id), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -722,24 +723,34 @@ else
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party
// Phone / Fax
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET('phone_pro') ? GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
print '<tr><td>'.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning');
print '<input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET('phone_pro') ? GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<td>'.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning');
print '<input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'</td>';
print '<td><input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
print '<tr><td>'.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning_mobile');
print '<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
print '<td>'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning_fax');
print '<input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
print '</tr>';
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party
// Email
print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'</td>';
print '<td><input type="text" name="email" id="email" value="'.(GETPOSTISSET('email') ? GETPOST('email', 'alpha') : $object->email).'"></td>';
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'</td>';
print '<td>';
print img_picto('', 'object_email');
print '<input type="text" name="email" id="email" value="'.(GETPOSTISSET('email') ? GETPOST('email', 'alpha') : $object->email).'"></td>';
print '</tr>';
if (!empty($conf->mailing->enabled))
@ -964,12 +975,12 @@ else
// Lastname
print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
print '<td colspan="3"><input name="lastname" id="lastname" type="text" class="minwidth200" maxlength="80" value="'.(isset($_POST["lastname"]) ?GETPOST("lastname") : $object->lastname).'" autofocus="autofocus"></td>';
print '<td colspan="3"><input name="lastname" id="lastname" type="text" class="minwidth200" maxlength="80" value="'.(GETPOSTISSET("lastname") ? GETPOST("lastname") : $object->lastname).'" autofocus="autofocus"></td>';
print '</tr>';
print '<tr>';
// Firstname
print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
print '<td colspan="3"><input name="firstname" id="firstname" type="text" class="minwidth200" maxlength="80" value="'.(isset($_POST["firstname"]) ?GETPOST("firstname") : $object->firstname).'"></td>';
print '<td colspan="3"><input name="firstname" id="firstname" type="text" class="minwidth200" maxlength="80" value="'.(GETPOSTISSET("firstname") ? GETPOST("firstname") : $object->firstname).'"></td>';
print '</tr>';
// Company
@ -988,13 +999,13 @@ else
print '</td></tr>';
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
print '<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="80" value="'.(isset($_POST["poste"]) ?GETPOST("poste") : $object->poste).'"></td></tr>';
print '<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="80" value="'.(GETPOSTISSET("poste") ? GETPOST("poste") : $object->poste).'"></td></tr>';
// Address
print '<tr><td><label for="address">'.$langs->trans("Address").'</label></td>';
print '<td colspan="3">';
print '<div class="paddingrightonly valignmiddle inline-block">';
print '<textarea class="flat minwidth200" name="address" id="address">'.(isset($_POST["address"]) ?GETPOST("address") : $object->address).'</textarea>';
print '<div class="paddingrightonly valignmiddle inline-block quatrevingtpercent">';
print '<textarea class="flat minwidth200 centpercent" name="address" id="address">'.(GETPOSTISSET("address") ? GETPOST("address", 'nohtml') : $object->address).'</textarea>';
print '</div><div class="paddingrightonly valignmiddle inline-block">';
if ($conf->use_javascript_ajax) print '<a href="#" id="copyaddressfromsoc">'.$langs->trans('CopyAddressFromSoc').'</a><br>';
print '</div>';
@ -1002,13 +1013,14 @@ else
// Zip / Town
print '<tr><td><label for="zipcode">'.$langs->trans("Zip").'</label> / <label for="town">'.$langs->trans("Town").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print $formcompany->select_ziptown((isset($_POST["zipcode"]) ?GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).'&nbsp;';
print $formcompany->select_ziptown((isset($_POST["town"]) ?GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).'&nbsp;';
print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print '</td></tr>';
// Country
print '<tr><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print $form->select_country(isset($_POST["country_id"]) ?GETPOST("country_id") : $object->country_id, 'country_id');
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country(GETPOSTISSET("country_id") ? GETPOST("country_id") : $object->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -1029,19 +1041,29 @@ else
}
// Phone
print '<tr><td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).'</td>';
print '<td><input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_pro') ?GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
print '<td>'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).'</td>';
print '<td><input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_perso') ?GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning');
print '<input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_pro') ?GETPOST('phone_pro', 'alpha') : $object->phone_pro).'"></td>';
print '<td>'.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning');
print '<input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_perso') ?GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').'</td>';
print '<td><input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_mobile') ?GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
print '<td>'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).'</td>';
print '<td><input type="text" name="fax" id="fax" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_fax') ?GETPOST('phone_fax', 'alpha') : $object->fax).'"></td></tr>';
print '<tr><td>'.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').'</td>';
print '<td>';
print img_picto('', 'object_phoning_mobile');
print '<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_mobile') ?GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td>';
print '<td>'.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning_fax');
print '<input type="text" name="fax" id="fax" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET('phone_fax') ?GETPOST('phone_fax', 'alpha') : $object->fax).'"></td></tr>';
// EMail
print '<tr><td>'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'</td>';
print '<td><input type="text" name="email" id="email" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>';
print '<tr><td>'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'</td>';
print '<td>';
print img_picto('', 'object_email');
print '<input type="text" name="email" id="email" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>';
if (!empty($conf->mailing->enabled))
{
$langs->load("mails");

View File

@ -489,7 +489,7 @@ class Contact extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1168,7 +1168,7 @@ class Contact extends CommonObject
}
// Removed extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) {
if (!$error) {
// For avoid conflicts if trigger used
$result = $this->deleteExtraFields();
if ($result < 0) $error++;

View File

@ -146,14 +146,16 @@ if ($id > 0)
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
}
$permtoedit = 0;
$morehtmlref .= '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
// Ref supplier
$morehtmlref .= '<br>';
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
@ -165,7 +167,8 @@ if ($id > 0)
if ($user->rights->contrat->creer)
{
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
//$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
$morehtmlref .= ' : ';
}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);

View File

@ -316,7 +316,7 @@ if (empty($reshook))
// Extrafields
$array_options = array();
// For avoid conflicts if trigger used
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -1035,7 +1035,7 @@ class Contrat extends CommonObject
}
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1383,7 +1383,7 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1588,7 +1588,7 @@ class Contrat extends CommonObject
{
$contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet");
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
if (!$error)
{
$contractline = new ContratLigne($this->db);
$contractline->array_options = $array_options;
@ -1777,7 +1777,7 @@ class Contrat extends CommonObject
$result = $this->update_statut($user);
if ($result >= 0)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
if (is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->fetch($rowid);
@ -1859,18 +1859,15 @@ class Contrat extends CommonObject
$error++;
}
if (empty($error)) {
if (!$error) {
// Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$contractline = new ContratLigne($this->db);
$contractline->id = $idline;
$result = $contractline->deleteExtraFields();
if ($result < 0)
{
$contractline = new ContratLigne($this->db);
$contractline->id = $idline;
$result = $contractline->deleteExtraFields();
if ($result < 0)
{
$error++;
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
}
$error++;
$this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error;
}
}
@ -3092,7 +3089,7 @@ class ContratLigne extends CommonObjectLine
$error++;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used
if (!$error) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3202,6 +3199,8 @@ class ContratLigne extends CommonObjectLine
{
global $conf, $user;
$error = 0;
// Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
$sql .= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,";
@ -3240,7 +3239,7 @@ class ContratLigne extends CommonObjectLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet');
// Insert of extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -136,6 +136,7 @@ if ($object->id)
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
// Project
if (!empty($conf->projet->enabled))
{

View File

@ -751,7 +751,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -170,12 +170,13 @@ abstract class CommonDocGenerator
*
* @param Societe $object Object
* @param Translate $outputlangs Language object for output
* @param string $array_key Name of the key for return array
* @return array Array of substitution key->code
*/
public function get_substitutionarray_thirdparty($object, $outputlangs)
public function get_substitutionarray_thirdparty($object, $outputlangs, $array_key = 'company')
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
if (empty($object->country) && !empty($object->country_code))
{
@ -221,27 +222,13 @@ abstract class CommonDocGenerator
'company_default_bank_bic'=>$object->bank_account->bic
);
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals();
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
$object->fetch_optionals();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
{
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
}
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
{
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
}
$array_thirdparty = array_merge($array_thirdparty, array('company_options_'.$key => $object->array_options ['options_'.$key]));
}
}
$array_thirdparty = $this->fill_substitutionarray_with_extrafields($object, $array_thirdparty, $extrafields, $array_key, $outputlangs);
}
return $array_thirdparty;
}
@ -251,13 +238,13 @@ abstract class CommonDocGenerator
*
* @param Contact $object contact
* @param Translate $outputlangs object for output
* @param array $array_key Name of the key for return array
* @param string $array_key Name of the key for return array
* @return array Array of substitution key->code
*/
public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
if (empty($object->country) && !empty($object->country_code))
{
@ -298,24 +285,13 @@ abstract class CommonDocGenerator
$array_key.'_civility' => $object->civility,
);
// Retrieve extrafields
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals();
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
$object->fetch_optionals();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
{
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
{
$object->array_options['options_'.$key] = price($object->array_options ['options_'.$key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
}
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
{
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
}
$array_contact = array_merge($array_contact, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
}
$array_contact = $this->fill_substitutionarray_with_extrafields($object, $array_contact, $extrafields, $array_key, $outputlangs);
}
return $array_contact;
}
@ -370,7 +346,7 @@ abstract class CommonDocGenerator
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
$sumpayed = $sumdeposit = $sumcreditnote = '';
$already_payed_all = 0;
@ -389,7 +365,7 @@ abstract class CommonDocGenerator
$remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
if ($object->fk_account > 0) {
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$bank_account = new Account($this->db);
$bank_account->fetch($object->fk_account);
}
@ -528,11 +504,6 @@ abstract class CommonDocGenerator
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
$extrafieldkey = $object->element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
$object->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
@ -605,7 +576,7 @@ abstract class CommonDocGenerator
}
// Retrieve extrafields
$extrafieldkey = $line->element;
$extrafieldkey = $line->table_element;
$array_key = "line";
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
@ -672,7 +643,7 @@ abstract class CommonDocGenerator
public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object')
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
dol_include_once('/core/lib/product.lib.php');
$object->list_delivery_methods($object->shipping_method_id);
$calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
@ -708,16 +679,13 @@ abstract class CommonDocGenerator
$array_shipment[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva;
}
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label('expedition', true);
$object->fetch_optionals();
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
$object->fetch_optionals();
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
}
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
}
return $array_shipment;
}

View File

@ -667,7 +667,7 @@ abstract class CommonObject
$namecoords .= $this->getFullName($langs, 1).'<br>'.$coords;
// hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
$out .= '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).'\',\''.dol_escape_js($langs->trans("HelpCopyToClipboard")).'\');">';
$out .= img_picto($langs->trans("Address"), 'object_address.png');
$out .= img_picto($langs->trans("Address"), 'map-marker-alt');
$out .= '</a> ';
}
$out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++;
@ -5351,9 +5351,14 @@ abstract class CommonObject
* Delete all extra fields values for the current object.
*
* @return int <0 if KO, >0 if OK
* @see deleteExtraLanguages(), insertExtraField(), updateExtraField(), setValueFrom()
*/
public function deleteExtraFields()
{
global $conf;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
$this->db->begin();
$table_element = $this->table_element;
@ -5383,18 +5388,18 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see insertExtraLanguages(), updateExtraField(), setValueFrom()
* @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom()
*/
public function insertExtraFields($trigger = '', $userused = null)
{
global $conf, $langs, $user;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
if (empty($userused)) $userused = $user;
$error = 0;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
if (!empty($this->array_options))
{
// Check parameters
@ -5792,18 +5797,18 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see updateExtraLanguages(), setValueFrom(), insertExtraFields()
* @see updateExtraLanguages(), insertExtraFields(), deleteExtraFields(), setValueFrom()
*/
public function updateExtraField($key, $trigger = null, $userused = null)
{
global $conf, $langs, $user;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0;
if (empty($userused)) $userused = $user;
$error = 0;
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
if (!empty($this->array_options) && isset($this->array_options["options_".$key]))
{
// Check parameters
@ -8174,7 +8179,7 @@ abstract class CommonObject
}
// Update extrafield
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -8335,7 +8340,7 @@ abstract class CommonObject
if (empty($error)) {
// Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$tmpobjectline = new $tmpforobjectlineclass($this->db);
$tmpobjectline->id = $idline;

View File

@ -69,7 +69,9 @@ class ExtraLanguages
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array this->attributes
* Load array this->attributes with list of fields per object that need an alternate translation.
* You can set variable MAIN_USE_ALTERNATE_TRANSLATION_FOR=elementA:fieldname,fieldname2;elementB:...
* Example: MAIN_USE_ALTERNATE_TRANSLATION_FOR=societe:name,town;contact:firstname,lastname
*
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
@ -86,11 +88,25 @@ class ExtraLanguages
if ($elementtype == 'contact') $elementtype = 'socpeople';
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
$array_name_label = array(
'societe' => array('name'=>'Name'),
'contact' => array('firstname' => 'Firstname', 'lastname' => 'Lastname')
);
$array_name_label = array();
if (! empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) {
$tmpelement = explode(';', $conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR);
foreach($tmpelement as $elementstring) {
$reg=array();
preg_match('/^(.*):(.*)$/', $elementstring, $reg);
$element = $reg[1];
$array_name_label[$element] = array();
$tmpfields=explode(',', $reg[2]);
foreach($tmpfields as $field) {
//var_dump($fields);
//$tmpkeyvar = explode(':', $fields);
//$array_name_label[$element][$tmpkeyvar[0]] = $tmpkeyvar[1];
$array_name_label[$element][$field] = $field;
}
}
}
//var_dump($array_name_label);
$this->attributes = $array_name_label;
return $array_name_label;

View File

@ -971,6 +971,7 @@ class FormFile
// Get object entity
if (!empty($conf->multicompany->enabled))
{
$regs = array();
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir, '/').'$/', $filedir, $regs);
$entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default
}

View File

@ -77,7 +77,7 @@ class FormOther
$sql .= " FROM ".MAIN_DB_PREFIX."export_model";
$sql .= " WHERE type = '".$this->db->escape($type)."'";
if (!empty($fk_user)) $sql .= " AND fk_user IN (0, ".$fk_user.")"; // An export model
$sql .= " ORDER BY rowid";
$sql .= " ORDER BY label";
$result = $this->db->query($sql);
if ($result)
{
@ -613,8 +613,6 @@ class FormOther
$numlines = count($lines);
for ($i = 0; $i < $numlines; $i++) {
if ($lines[$i]->fk_parent == $parent) {
$var = !$var;
//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
// Break on a new project

View File

@ -3143,8 +3143,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'bank_account', 'barcode', 'bank', 'bookmark', 'bom', 'building', 'cash-register', 'check', 'close_title', 'company', 'contact', 'cubes',
'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'grip', 'grip_title', 'help', 'language', 'list', 'listlight', 'lot',
'money-bill-alt', 'mrp', 'note', 'stock',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', 'language', 'list', 'listlight', 'lot',
'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'stock',
'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom',
'object_category', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
@ -3153,10 +3153,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other',
'object_phoning', 'object_phoning_fax', 'object_email',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email',
'off', 'on',
'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'resize', 'service', 'stats', 'trip',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench',
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top',
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'preview', 'project', 'projectpub', 'hrm', 'members', 'ticket', 'generic',
@ -3194,7 +3194,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'other'=>'square',
'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
'resize'=>'crop', 'supplier_proposal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'resource'=>'laptop-house',
'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
@ -3271,10 +3271,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'address'=>'#37a', 'building'=>'#37a', 'bom'=>'#a69944',
'companies'=>'#37a', 'company'=>'#37a', 'contact'=>'#37a', 'dynamicprice'=>'#a69944',
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'listlight'=>'#999',
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'warning'=>''
'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'globe-americas'=>'#aaa'
);
if (isset($arrayconvpictotocolor[$pictowithouttext])) {
$facolor = $arrayconvpictotocolor[$pictowithouttext];
@ -4643,7 +4644,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
{
if ($currency_code == 'auto') $currency_code = $conf->currency;
$listofcurrenciesbefore = array('USD', 'GBP', 'AUD', 'HKD', 'MXN', 'PEN', 'CNY', 'CAD');
$listofcurrenciesbefore = array('AUD', 'CAD', 'CNY', 'COP', 'CLP', 'GBP', 'HKD', 'MXN', 'PEN', 'USD');
$listoflanguagesbefore = array('nl_NL');
if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore))
{
@ -4663,9 +4664,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
/**
* Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user.
* Function to use on each input amount before any numeric test or database insert. A better name for this function
* should be text2num().
* should be roundtext2num().
*
* @param float $amount Amount to convert/clean
* @param float $amount Amount to convert/clean or round
* @param string $rounding ''=No rounding
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)

View File

@ -352,7 +352,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
if (! empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -372,6 +372,12 @@ class pdf_einstein extends ModelePDFCommandes
if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
}
}
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
}
if ($notetoshow)
{
$tab_top -= 2;

View File

@ -8,7 +8,7 @@
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -456,6 +456,11 @@ class pdf_crabe extends ModelePDFFactures
if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
}
}
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
}
if ($notetoshow)
{
$tab_top -= 2;

View File

@ -347,7 +347,10 @@ class modFournisseur extends DolibarrModules
case 'sellist':
$tmp = '';
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift(array_keys($tmpparam['options']));
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$var=array_keys($tmpparam['options']);
$tmp=array_shift($var);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp;
break;
}
@ -420,7 +423,7 @@ class modFournisseur extends DolibarrModules
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_supplier'=>"RefSupplier", 'f.datec'=>"InvoiceDateCreation",
'f.datef'=>"DateInvoice", 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.paye'=>"InvoicePaid",
'f.fk_statut'=>'InvoiceStatus', 'f.note_public'=>"InvoiceNote", 'p.rowid'=>'PaymentId', 'pf.amount'=>'AmountPayment',
'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'p.fk_bank'=>'IdTransaction', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
);
//$this->export_TypeFields_array[$r]=array(
// 's.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text',
@ -432,7 +435,7 @@ class modFournisseur extends DolibarrModules
's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text',
's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.total_ht'=>"Numeric",
'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.note_public'=>"Text", 'pf.amount'=>'Numeric',
'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', 'project.ref'=>'Text', 'project.title'=>'Text'
'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', 'p.fk_bank'=>'Numeric', 'project.ref'=>'Text', 'project.title'=>'Text'
);
$this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company',
@ -440,7 +443,7 @@ class modFournisseur extends DolibarrModules
's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company',
'f.rowid'=>"invoice", 'f.ref'=>"invoice", 'f.ref_supplier'=>"invoice", 'f.datec'=>"invoice", 'f.datef'=>"invoice", 'f.total_ht'=>"invoice",
'f.total_ttc'=>"invoice", 'f.total_tva'=>"invoice", 'f.paye'=>"invoice", 'f.fk_statut'=>'invoice', 'f.note_public'=>"invoice", 'p.rowid'=>'payment', 'pf.amount'=>'payment',
'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project');
'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project');
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";

View File

@ -589,7 +589,7 @@ class modService extends DolibarrModules
'sp.remise_percent'=>'DiscountQtyMin'
));
if ($conf->multicurrency->enabled)
if (!empty($conf->multicurrency->enabled))
{
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line
@ -626,7 +626,7 @@ class modService extends DolibarrModules
// TODO Make this field not required and calculate it from price and qty
'sp.remise_percent' => '20'
));
if ($conf->multicurrency->enabled)
if (!empty($conf->multicurrency->enabled))
{
$this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency',

View File

@ -451,7 +451,7 @@ class modSociete extends DolibarrModules
's.fk_multicurrency' => 'MulticurrencyUsed',
's.multicurrency_code' => 'MulticurrencyCurrency'
);
if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel';
if (!empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -579,6 +579,7 @@ class modSociete extends DolibarrModules
'extra' => MAIN_DB_PREFIX.'socpeople_extrafields'
); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array(//field order as per structure of table llx_socpeople
's.rowid' => 'Id',
's.datec' => "DateCreation",
's.fk_soc' => 'ThirdPartyName',
's.civility' => 'UserTitle',
@ -645,6 +646,7 @@ class modSociete extends DolibarrModules
's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
);
$this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_socpeople
's.rowid' => '1',
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
's.fk_soc' => 'Third Party name eg. TPBigCompany',
's.civility' => 'Title of civility eg: MR...matches field "code" in table "'.MAIN_DB_PREFIX.'c_civility"',
@ -666,6 +668,9 @@ class modSociete extends DolibarrModules
's.note_private' => "My private note",
's.note_public' => "My public note"
);
$this->import_updatekeys_array[$r] = array(
's.rowid' => 'Id'
);
// Import Bank Accounts
$r++;

View File

@ -130,7 +130,7 @@ class doc_generic_task_odt extends ModelePDFTask
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
$resarray = array(
$array_key.'_id'=>$object->id,
@ -150,11 +150,6 @@ class doc_generic_task_odt extends ModelePDFTask
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
$extrafieldkey = $object->element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
$object->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
@ -167,16 +162,17 @@ class doc_generic_task_odt extends ModelePDFTask
/**
* Define array with couple substitution key => substitution value
*
* @param array $task Task Object
* @param Task $task Task Object
* @param Translate $outputlangs Lang object to use for output
* @param string $array_key Name of the key for return array
* @return array Return a substitution array
*/
public function get_substitutionarray_tasks($task, $outputlangs)
public function get_substitutionarray_tasks($task, $outputlangs, $array_key = 'task')
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
return array(
$resarray = array(
'task_ref'=>$task->ref,
'task_fk_project'=>$task->fk_project,
'task_projectref'=>$task->projectref,
@ -184,7 +180,10 @@ class doc_generic_task_odt extends ModelePDFTask
'task_label'=>$task->label,
'task_description'=>$task->description,
'task_fk_parent'=>$task->fk_parent,
'task_duration'=>$task->duration,
'task_duration'=>$task->duration_effective,
'task_duration_formated'=>convertSecondToTime($task->duration_effective, 'allhourmin'),
'task_planned_workload'=>$task->planned_workload,
'task_planned_workload_formated'=>convertSecondToTime($task->planned_workload, 'allhourmin'),
'task_progress'=>$task->progress,
'task_public'=>$task->public,
'task_date_start'=>dol_print_date($task->date_start, 'day'),
@ -192,6 +191,16 @@ class doc_generic_task_odt extends ModelePDFTask
'task_note_private'=>$task->note_private,
'task_note_public'=>$task->note_public
);
// Retrieve extrafields
if (is_array($task->array_options) && count($task->array_options))
{
$task->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, $array_key, $outputlangs);
}
return $resarray;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -7,7 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
*
* This program is free software; you can redistribute it and/or modify
@ -439,6 +439,11 @@ class pdf_azur extends ModelePDFPropales
if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
}
}
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
}
if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0)
{
$tmpuser = new User($this->db);

View File

@ -284,11 +284,19 @@ if ($line->special_code == 3) { ?>
{
$tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht);
$tooltiponprice .= '<br>'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva);
if (price2num($line->total_localtax1)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1);
if (price2num($line->total_localtax2)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax2);
if (! $senderissupplier && is_object($object->thirdparty)) {
if ($object->thirdparty->useLocalTax(1)) {
if (price2num($line->total_localtax1)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1);
else $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
}
if ($object->thirdparty->useLocalTax(1)) {
if (price2num($line->total_localtax2)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax2);
else $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
}
}
$tooltiponprice .= '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc);
print '<span class="classfortooltip" title="'.$tooltiponprice.'">';
print '<span class="classfortooltip" title="'.dol_escape_htmltag($tooltiponprice).'">';
}
print price($line->total_ht);
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))

View File

@ -432,7 +432,7 @@ class Don extends CommonObject
// Update extrafield
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -519,7 +519,7 @@ class Don extends CommonObject
// Update extrafield
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -380,7 +380,7 @@ class Expedition extends CommonObject
}
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1046,7 +1046,8 @@ class Expedition extends CommonObject
}
}
$line->entrepot_id = $linebatch->entrepot_id;
$line->origin_line_id = $dbatch['ix_l'];
$line->origin_line_id = $dbatch['ix_l']; // deprecated
$line->fk_origin_line = $dbatch['ix_l'];
$line->qty = $dbatch['qty'];
$line->detail_batch = $tab;
@ -2617,7 +2618,7 @@ class ExpeditionLigne extends CommonObjectLine
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -2691,7 +2692,7 @@ class ExpeditionLigne extends CommonObjectLine
if (!$error && $this->db->query($sql))
{
// Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)
@ -2895,7 +2896,7 @@ class ExpeditionLigne extends CommonObjectLine
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -704,8 +704,8 @@ class ExpenseReport extends CommonObject
// phpcs:enable
global $langs;
$labelStatus = $langs->trans($this->statuts[$status]);
$labelStatusShort = $langs->trans($this->statuts_short[$status]);
$labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
$labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]);
$statusType = $this->statuts_logo[$status];

View File

@ -305,7 +305,7 @@ class Fichinter extends CommonObject
if (!$resql) $error++;
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -385,7 +385,7 @@ class Fichinter extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql))
{
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1001,7 +1001,7 @@ class Fichinter extends CommonObject
if (!$resql) $error++;
}
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
// Remove extrafields
$res = $this->deleteExtraFields();
@ -1552,7 +1552,7 @@ class FichinterLigne extends CommonObjectLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
$this->rowid = $this->id;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1623,7 +1623,7 @@ class FichinterLigne extends CommonObjectLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -2063,7 +2063,7 @@ class CommandeFournisseur extends CommonOrder
}
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)
@ -3626,7 +3626,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->rowid = $this->id;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3716,7 +3716,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$result = $this->db->query($sql);
if ($result > 0)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -210,22 +210,11 @@ class CommandeFournisseurDispatch extends CommonObject
}
}
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('commandefournisseurdispatchdao'));
$parameters = array('id'=>$this->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Create extrafields
if (! $error)
{
$result=$this->insertExtraFields();
if ($result < 0) $error++;
}
// Commit or rollback
@ -373,7 +362,7 @@ class CommandeFournisseurDispatch extends CommonObject
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
if (empty($this->id) && !empty($this->rowid))$this->id = $this->rowid;
$result = $this->insertExtraFields();

View File

@ -12,7 +12,7 @@
* Copyright (C) 2015-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -558,7 +558,7 @@ class FactureFournisseur extends CommonInvoice
if ($result > 0)
{
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
if ($result < 0)
@ -977,7 +977,7 @@ class FactureFournisseur extends CommonInvoice
}
}
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
if (! $error)
{
$result=$this->insertExtraFields();
if ($result < 0)
@ -1243,7 +1243,7 @@ class FactureFournisseur extends CommonInvoice
}
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)
@ -3145,7 +3145,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->deleteObjectLinked();
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (! $error)
{
$result=$this->deleteExtraFields();
if ($result < 0)
@ -3154,7 +3154,7 @@ class SupplierInvoiceLine extends CommonObjectLine
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
if (!$error) {
// Supprime ligne
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det ';
@ -3265,7 +3265,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->rowid = $this->id;
$error = 0;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3406,7 +3406,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->rowid = $this->id; // backward compatibility
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -1064,7 +1064,7 @@ if (empty($reshook))
if (!$error)
{
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
if ($result < 0)
@ -1190,7 +1190,7 @@ if (empty($reshook))
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
{
$lines[$i]->fetch_optionals();
$array_option = $lines[$i]->array_options;

View File

@ -40,6 +40,17 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = 'a.datep,a.id';
if (!$sortorder) $sortorder = 'DESC,DESC';
if (GETPOST('actioncode', 'array'))
{
$actioncode = GETPOST('actioncode', 'array', 3);
@ -212,12 +223,12 @@ if (!empty($object->id))
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
// List of done actions
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters);
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
// End of page

View File

@ -951,7 +951,7 @@ if (empty($reshook))
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
}
@ -1597,7 +1597,7 @@ if (empty($reshook))
if (!$error)
{
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $object->insertExtraFields('BILL_SUPPLIER_MODIFY');
if ($result < 0)

View File

@ -42,6 +42,15 @@ ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande
UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA';
create table llx_c_shipment_package_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(50) NOT NULL, -- Short name
description varchar(255), -- Description
active integer DEFAULT 1 NOT NULL, -- Active or not
entity integer DEFAULT 1 NOT NULL -- Multi company id
)ENGINE=innodb;
-- For v12
@ -229,6 +238,7 @@ ALTER TABLE llx_product_batch MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_commande_fournisseur_dispatch MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_stock_mouvement MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_mrp_production MODIFY COLUMN batch varchar(128);
ALTER TABLE llx_mrp_production MODIFY qty real NOT NULL DEFAULT 1;
create table llx_categorie_website_page
(
@ -252,11 +262,3 @@ ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid);
--Dictionary of package type because filename in V11 was incomplete
create table llx_c_shipment_package_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(50) NOT NULL, -- Short name
description varchar(255), -- Description
active integer DEFAULT 1 NOT NULL, -- Active or not
entity integer DEFAULT 1 NOT NULL -- Multi company id
)ENGINE=innodb;

View File

@ -58,7 +58,7 @@ create table llx_commande
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...)
pos_source varchar(32), -- name of POS station when order is generated by a POS module
pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket.
facture tinyint default 0,
fk_account integer, -- bank account
fk_currency varchar(3), -- currency code

View File

@ -65,7 +65,7 @@ create table llx_facture
fk_user_closing integer, -- user closing
module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...)
pos_source varchar(32), -- name of POS station when invoice is generated by a POS module
pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket.
fk_fac_rec_source integer, -- facture rec source
fk_facture_source integer, -- facture origin if credit notes or replacement invoice
fk_projet integer DEFAULT NULL, -- project invoice is linked to

View File

@ -20,15 +20,15 @@ CREATE TABLE llx_societe_account(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1,
key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined)
login varchar(128) NOT NULL,
pass_encoding varchar(24),
pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password
fk_soc integer,
fk_website integer, -- id of local web site
site varchar(128), -- name of external web site
site_account varchar(128), -- a key to identify the account on external web site
fk_website integer, -- id of local web site
key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined)
note_private text,
date_last_login datetime,
date_previous_login datetime,

View File

@ -1030,3 +1030,4 @@ DeleteFileHeader=Confirm file delete
DeleteFileText=Do you really want delete this file?
ShowOtherLanguages=Show other languages
SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language
NotUsedForThisCustomer=Not used for this customer

View File

@ -56,11 +56,12 @@ ToConsume=To consume
ToProduce=To produce
QtyAlreadyConsumed=Qty already consumed
QtyAlreadyProduced=Qty already produced
QtyRequiredIfNoLoss=Qty required if there is no loss (Manufacturing efficiency is 100%%)
ConsumeOrProduce=Consume or Produce
ConsumeAndProduceAll=Consume and Produce All
Manufactured=Manufactured
TheProductXIsAlreadyTheProductToProduce=The product to add is already the product to produce.
ForAQuantityOf1=For a quantity to produce of 1
ForAQuantityOf=For a quantity to produce of %s
ConfirmValidateMo=Are you sure you want to validate this Manufacturing Order?
ConfirmProductionDesc=By clicking on '%s', you will validate the consumption and/or production for the quantities set. This will also update the stock and record stock movements.
ProductionForRef=Production of %s

View File

@ -77,7 +77,7 @@ BlogPost=Blog post
WebsiteAccount=Website account
WebsiteAccounts=Website accounts
AddWebsiteAccount=Create web site account
BackToListOfThirdParty=Back to list for Third Party
BackToListForThirdParty=Back to list for the third-party
DisableSiteFirst=Disable website first
MyContainerTitle=My web site title
AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists)

View File

@ -475,7 +475,7 @@ if ($id > 0)
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Capital
if ($action == 'edit')

View File

@ -11,6 +11,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2020 Demarest Maxime <maxime@indelog.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -2348,6 +2349,35 @@ function main_area($title = '')
print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
// Permit to add user company information on each printed document by set SHOW_SOCINFO_ON_PRINT
if (! empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09')))
{
global $hookmanager;
$hookmanager->initHooks(array('showsocinfoonprint'));
$parameters = array();
$reshook = $hookmanager->executeHooks('showSocinfoOnPrint', $parameters);
if (empty($reshook))
{
print '<!-- Begin show mysoc info header -->'."\n";
print '<div id="mysoc-info-header">'."\n";
print '<table class="centpercent div-table-responsive">'."\n";
print '<tbody>';
print '<tr><td rowspan="0" class="width20p">';
if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO))
print '<img id="mysoc-info-header-logo" style="max-width:100%" alt="" src="'.DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_LOGO)).'">';
print '</td><td rowspan="0" class="width50p"></td></tr>'."\n";
print '<tr><td class="titre bold">'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'</td></tr>'."\n";
print '<tr><td>'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).'<br>'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).' '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).'</td></tr>'."\n";
if (!empty($conf->global->MAIN_INFO_SOCIETE_TEL)) print '<tr><td style="padding-left: 1em" class="small">'.$langs->trans("Phone").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'</td></tr>';
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) print '<tr><td style="padding-left: 1em" class="small">'.$langs->trans("Email").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'</td></tr>';
if (!empty($conf->global->MAIN_INFO_SOCIETE_WEB)) print '<tr><td style="padding-left: 1em" class="small">'.$langs->trans("Web").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'</td></tr>';
print '</tbody>';
print '</table>'."\n";
print '</div>'."\n";
print '<!-- End show mysoc info header -->'."\n";
}
}
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@ -590,7 +591,7 @@ class Mo extends CommonObject
}
/**
* Erase and update the line to produce.
* Erase and update the line to consume and to produce.
*
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
@ -648,7 +649,7 @@ class Mo extends CommonObject
if ($line->qty_frozen) {
$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
} else {
$moline->qty = round($line->qty * $this->qty / $line->efficiency, 2);
$moline->qty = price2num(($line->qty / $bom->qty) * $this->qty / $line->efficiency, 'MS'); // Calculate with Qty to produce and more presition
}
if ($moline->qty <= 0) {
$error++;
@ -1268,7 +1269,7 @@ class Mo extends CommonObject
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td class="right">'.$langs->trans('Qty').' <span class="opacitymedium">('.$langs->trans("ForAQuantityOf1").')</span></td>';
print '<td class="right">'.$langs->trans('Qty').' <span class="opacitymedium">('.$langs->trans("ForAQuantityOf", $this->bom->qty).')</span></td>';
print '<td class="center">'.$langs->trans('QtyFrozen').'</td>';
print '<td class="center">'.$langs->trans('DisableStockChange').'</td>';
//print '<td class="right">'.$langs->trans('Efficiency').'</td>';
@ -1334,6 +1335,11 @@ class Mo extends CommonObject
// TODO
}
$this->tpl['qty_bom'] = 1;
if (is_object($this->bom) && $this->bom->qty > 1) {
$this->tpl['qty_bom'] = $this->bom->qty;
}
$this->tpl['qty'] = $line->qty;
$this->tpl['qty_frozen'] = $line->qty_frozen;
$this->tpl['disable_stock_change'] = $line->disable_stock_change;

View File

@ -293,6 +293,7 @@ if ($action == 'create')
print '<table class="noborder centpercent">';
$object->lines = $objectbom->lines;
$object->bom = $objectbom;
$object->printOriginLinesList('', array());

View File

@ -684,6 +684,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</tr>';
if ($action == 'addconsumeline') {
print '<!-- Add line to consume -->'."\n";
print '<tr class="liste_titre">';
print '<td>';
print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300');
@ -691,7 +692,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
print '<td class="right"></td>';
print '<td>';
print '<input type="submit" class="button" name="addconsumelinebutton" value="'.$langs->trans("Add").'">';
print '<input type="submit" class="button buttongen" name="addconsumelinebutton" value="'.$langs->trans("Add").'">';
print '</td>';
if ($conf->productbatch->enabled) {
print '<td></td>';
@ -791,6 +792,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
$i = 1;
print '<!-- Enter line to consume -->'."\n";
print '<tr>';
print '<td>'.$langs->trans("ToConsume").'</td>';
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
@ -800,8 +802,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if (empty($line->disable_stock_change)) {
$preselected = (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i) ? GETPOST('idwarehouse-'.$line->id.'-'.$i) : 'ifone');
print $formproduct->selectWarehouses($preselected, 'idwarehouse-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1);
$preselected = (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i) ? GETPOST('idwarehouse-'.$line->id.'-'.$i) : ($tmpproduct->fk_default_warehouse > 0 ? $tmpproduct->fk_default_warehouse : 'ifone'));
print $formproduct->selectWarehouses($preselected, 'idwarehouse-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth300');
} else {
print '<span class="opacitymedium">'.$langs->trans("DisableStockChange").'</span>';
}
@ -949,7 +951,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone'));
print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'csswarehouse_'.$line->id.'_'.$i);
print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth300 csswarehouse_'.$line->id.'_'.$i);
} else {
print '<span class="opacitymedium">'.$langs->trans("NoStockChangeOnServices").'</span>';
}

View File

@ -24,13 +24,20 @@ if (empty($conf) || !is_object($conf))
}
if (!is_object($form)) $form = new Form($db);
$qtytoconsumeforline = $this->tpl['qty'] / $this->tpl['efficiency'];
/*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) {
$qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom'];
}*/
$qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS');
?>
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
<?php
print '<tr class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
print '<td>'.$this->tpl['label'].'</td>';
print '<td class="right">'.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.round($this->tpl['qty'] / $this->tpl['efficiency'], 2) : '').'</td>';
print '<td class="right">'.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').'</td>';
print '<td class="center">'.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').'</td>';
print '<td class="center">'.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').'</td>';
//print '<td class="right">'.$this->tpl['efficiency'].'</td>';

View File

@ -1052,7 +1052,7 @@ class Product extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
if (!$error) {
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
@ -1265,7 +1265,7 @@ class Product extends CommonObject
}
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0) {
@ -4938,7 +4938,7 @@ class Product extends CommonObject
{
$filterStatus = '4';
if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus;
$result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used.
$result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used.
if ($result < 0) dol_print_error($this->db, $this->error);
$stock_reception_fournisseur = $this->stats_reception['qty'];
}

View File

@ -64,14 +64,14 @@ if ($id > 0 || !empty($ref))
* Actions
*/
if ($cancel) $action ='';
if ($cancel) $action = '';
// Action association d'un sousproduit
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
{
$error=0;
$error = 0;
$maxprod = GETPOST("max_prod", 'int');
for ($i=0; $i < $maxprod; $i++)
for ($i = 0; $i < $maxprod; $i++)
{
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
if ($qty > 0)
@ -109,13 +109,13 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
}
}
if (! $error)
if (!$error)
{
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
}
}
elseif($action==='save_composed_product')
elseif ($action === 'save_composed_product')
{
$TProduct = GETPOST('TProduct', 'array');
if (!empty($TProduct))
@ -540,38 +540,38 @@ if ($id > 0 || !empty($ref))
if ($resql)
{
$num = $db->num_rows($resql);
$i=0;
$i = 0;
if($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
if ($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
$MAX = 100;
while ($i < min($num, $MAX))
{
$objp = $db->fetch_object($resql);
if($objp->rowid != $id)
if ($objp->rowid != $id)
{
// check if a product is not already a parent product of this one
$prod_arbo=new Product($db);
$prod_arbo->id=$objp->rowid;
$prod_arbo = new Product($db);
$prod_arbo->id = $objp->rowid;
// This type is not supported (not required to have virtual products working).
if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT)
{
$is_pere=0;
$is_pere = 0;
$prod_arbo->get_sousproduits_arbo();
// associations sousproduits
$prods_arbo = $prod_arbo->get_arbo_each_prod();
if (count($prods_arbo) > 0)
{
foreach($prods_arbo as $key => $value)
foreach ($prods_arbo as $key => $value)
{
if ($value[1]==$id)
if ($value[1] == $id)
{
$is_pere=1;
$is_pere = 1;
}
}
}
if ($is_pere==1)
if ($is_pere == 1)
{
$i++;
continue;

View File

@ -293,13 +293,19 @@ if ($action == 'create')
// Country
print '<tr><td>'.$langs->trans('Country').'</td><td>';
print img_picto('', 'globe-americas', 'class="paddingright"');
print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Phone / Fax
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td><input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td><input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
print img_picto('', 'object_phoning', 'class="paddingright"');
print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
print '<td>';
print img_picto('', 'object_phoning_fax', 'class="paddingright"');
print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';
@ -395,7 +401,7 @@ else
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Parent entrepot
$parentwarehouse = new Entrepot($db);
@ -429,7 +435,7 @@ else
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Value
print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
@ -723,13 +729,18 @@ else
// Country
print '<tr><td>'.$langs->trans('Country').'</td><td>';
print img_picto('', 'globe-americas', 'class="paddingright"');
print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Phone / Fax
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td><input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td><input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
print img_picto('', 'object_phoning', 'class="paddingright"');
print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td>';
print img_picto('', 'object_phoning_fax', 'class="paddingright"');
print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';

View File

@ -184,10 +184,10 @@ class Entrepot extends CommonObject
$error = 0;
$this->libelle = trim($this->libelle);
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility
// Si libelle non defini, erreur
if ($this->libelle == '')
$this->label = trim($this->label);
if ($this->label == '')
{
$this->error = "ErrorFieldRequired";
return 0;
@ -198,7 +198,7 @@ class Entrepot extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)";
$sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
$sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result = $this->db->query($sql);
@ -221,7 +221,7 @@ class Entrepot extends CommonObject
// Actions on extra fields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -272,6 +272,7 @@ class Entrepot extends CommonObject
$error = 0;
if (empty($id)) $id = $this->id;
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility
// Check if new parent is already a child of current warehouse
if (!empty($this->fk_parent))
@ -285,7 +286,7 @@ class Entrepot extends CommonObject
}
}
$this->libelle = trim($this->libelle);
$this->label = trim($this->label);
$this->description = trim($this->description);
$this->lieu = trim($this->lieu);
@ -296,7 +297,7 @@ class Entrepot extends CommonObject
$this->country_id = ($this->country_id > 0 ? $this->country_id : 0);
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
$sql .= " SET ref = '".$this->db->escape($this->libelle)."'";
$sql .= " SET ref = '".$this->db->escape($this->label)."'";
$sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL");
$sql .= ", description = '".$this->db->escape($this->description)."'";
$sql .= ", statut = ".$this->statut;
@ -319,7 +320,7 @@ class Entrepot extends CommonObject
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) {
if (!$error) {
$result = $this->insertExtraFields();
if ($result < 0)
{
@ -383,7 +384,7 @@ class Entrepot extends CommonObject
// Removed extrafields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)
@ -715,7 +716,7 @@ class Entrepot extends CommonObject
$result = '';
$label = '<u>'.$langs->trans("ShowWarehouse").'</u>';
$label = '<u>'.$langs->trans("Warehouse").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref);
if (!empty($this->lieu)) {
$label .= '<br><b>'.$langs->trans('LocationSummary').':</b> '.$this->lieu;
@ -731,7 +732,7 @@ class Entrepot extends CommonObject
{
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label = $langs->trans("ShowWarehouse");
$label = $langs->trans("Warehouse");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
@ -765,7 +766,7 @@ class Entrepot extends CommonObject
// Initialize parameters
$this->id = 0;
$this->libelle = 'WAREHOUSE SPECIMEN';
$this->label = 'WAREHOUSE SPECIMEN';
$this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now, 'dayhourlog');
$this->statut = 1;
$this->specimen = 1;

View File

@ -185,7 +185,7 @@ class Productlot extends CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -359,7 +359,7 @@ class Productlot extends CommonObject
}
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -574,7 +574,7 @@ if ($resql)
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
print '<tr>';
@ -602,7 +602,7 @@ if ($resql)
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Value
print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';

View File

@ -316,7 +316,7 @@ class Project extends CommonObject
// Update extrafield
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -405,7 +405,7 @@ class Project extends CommonObject
// Update extrafield
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -26,6 +26,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
/**
@ -204,7 +205,7 @@ class Task extends CommonObject
// Update extrafield
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -383,7 +384,7 @@ class Task extends CommonObject
// Update extrafield
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -186,30 +186,25 @@ if (empty($reshook))
if ($action == 'update_extras')
{
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
$object->oldcopy = dol_clone($object);
if (!$error)
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('receptiondao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} elseif ($reshook < 0)
$error++;
}
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none'));
if ($ret < 0) $error++;
if ($error)
$action = 'edit_extras';
if (!$error)
{
// Actions on extra fields
$result = $object->insertExtraFields('RECEPTION_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)
$action = 'edit_extras';
}
// Create reception

View File

@ -305,24 +305,12 @@ class Reception extends CommonObject
}
}
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$action = 'add';
$hookmanager->initHooks(array('receptiondao'));
$parameters = array('socid'=>$this->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Create extrafields
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$result=$this->insertExtraFields();
if ($result < 0) $error++;
}
elseif ($reshook < 0) $error++;
if (!$error && !$notrigger)
{
@ -330,29 +318,22 @@ class Reception extends CommonObject
$result = $this->call_trigger('RECEPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error)
{
$this->db->commit();
return $this->id;
}
else
{
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
}
if (!$error)
{
$this->db->commit();
return $this->id;
}
else
{
$error++;
$this->error = $this->db->lasterror()." - sql=$sql";
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -3;
return -1 * $error;
}
}
else
@ -769,7 +750,7 @@ class Reception extends CommonObject
}
// extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0)
$line->array_options = $array_options;
$line->fk_product = $fk_product;

View File

@ -136,7 +136,7 @@ class Dolresource extends CommonObject
$action = 'create';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -309,7 +309,7 @@ class Dolresource extends CommonObject
$action = 'update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -160,7 +160,7 @@ class PaymentSalary extends CommonObject
// Update extrafield
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -449,7 +449,7 @@ class PaymentSalary extends CommonObject
// Update extrafield
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -1330,6 +1330,7 @@ else
// Country
print '<tr><td>'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id));
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -1977,6 +1978,7 @@ else
// Country
print '<tr><td>'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).'</td><td colspan="3">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';

View File

@ -28,9 +28,9 @@ require_once NUSOAP_PATH.'/nusoap.php';
$langs->load("companies");
//http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
$WS_DOL_URL = 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService';
$WS_DOL_URL = 'https://ec.europa.eu/taxation_customs/vies/services/checkVatService';
//$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl';
$WS_DOL_URL_WSDL = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
$WS_DOL_URL_WSDL = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
$WS_METHOD = 'checkVat';

View File

@ -129,7 +129,7 @@ class Thirdparties extends DolibarrApi
$sql .= " FROM ".MAIN_DB_PREFIX."societe as t";
if ($category > 0) {
if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c";
if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
if (!in_array($mode, array(1, 2, 3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc";
}
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";

View File

@ -1393,7 +1393,7 @@ class Societe extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -1771,7 +1771,7 @@ class Societe extends CommonObject
}
// Removed extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)

View File

@ -79,15 +79,15 @@ class SocieteAccount extends CommonObject
public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1),
'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Key account',),
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10),
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1),
'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30),
'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1),
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
'site' => array('type'=>'varchar(128)', 'label'=>'Site', 'visible'=>-1, 'enabled'=>1, 'position'=>41),
'site_account' => array('type'=>'varchar(128)', 'label'=>'SiteAccount', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'help'=>'A key to identify the account on external web site'),
'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>43, 'notnull'=>-1, 'index'=>1),
'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'index'=>1),
'site' => array('type'=>'varchar(128)', 'label'=>'ExternalSite', 'visible'=>0, 'enabled'=>1, 'position'=>43, 'help'=>'Name of the website or service if this is account on an external website or service'),
'site_account' => array('type'=>'varchar(128)', 'label'=>'ExternalSiteAccount', 'visible'=>0, 'enabled'=>1, 'position'=>44, 'help'=>'A key to identify the account on external web site if this is an account on an external website'),
'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>0, 'enabled'=>1, 'position'=>48, 'notnull'=>0, 'index'=>1, 'searchall'=>1, 'comment'=>'The id of third party in the external web site (for site_account if site_account defined)',),
'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,),
'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,),
//'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
@ -405,11 +405,10 @@ class SocieteAccount extends CommonObject
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
$result = '';
$companylink = '';
$this->ref = $this->login;
$label = '<u>'.$langs->trans("SocieteAccount").'</u>';
$label = '<u>'.$langs->trans("WebsiteAccount").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Login').':</b> '.$this->ref;
//$label.= '<b>' . $langs->trans('WebSite') . ':</b> ' . $this->ref;
@ -429,7 +428,7 @@ class SocieteAccount extends CommonObject
{
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label = $langs->trans("ShowsocieteAccount");
$label = $langs->trans("WebsiteAccount");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -449,6 +449,8 @@ while ($i < min($num, $limit))
// Store properties in $object
$objectwebsiteaccount->id = $obj->rowid;
$objectwebsiteaccount->login = $obj->login;
$objectwebsiteaccount->ref = $obj->login;
foreach ($objectwebsiteaccount->fields as $key => $val)
{
if (property_exists($obj, $key)) $object->$key = $obj->$key;

View File

@ -353,7 +353,7 @@ if (empty($reshook))
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
if (method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -1063,7 +1063,7 @@ class SupplierProposal extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -2116,16 +2116,13 @@ class SupplierProposal extends CommonObject
// Removed extrafields
if (!$error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}
if (!$error)
@ -3106,7 +3103,7 @@ class SupplierProposalLine extends CommonObjectLine
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'supplier_proposaldet');
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@ -3155,7 +3152,7 @@ class SupplierProposalLine extends CommonObjectLine
if ($this->db->query($sql))
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)
@ -3277,7 +3274,7 @@ class SupplierProposalLine extends CommonObjectLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

View File

@ -210,7 +210,9 @@ textarea.cke_source:focus
{
box-shadow: none;
}
div#cke_dp_desc {
margin-top: 5px;
}
textarea {
border-radius: 0;
border-top:solid 1px rgba(0,0,0,.2);

View File

@ -145,7 +145,7 @@ div.mainmenu.generic4::before {
/* Define color of some picto */
.fa-phone, .fa-fax {
.fa-phone, .fa-mobile-alt, .fa-fax {
opacity: 0.5;
color: #440;
}

View File

@ -408,11 +408,9 @@ class Ticket extends CommonObject
//Update extrafield
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
}
@ -838,11 +836,9 @@ class Ticket extends CommonObject
if (!$error) {
// Update extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
}

View File

@ -1094,7 +1094,7 @@ class User extends CommonObject
}
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->deleteExtraFields();
if ($result < 0)
@ -1762,7 +1762,7 @@ class User extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)

Some files were not shown because too many files have changed in this diff Show More