diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5e56ac2a1fc..fed73d7b002 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,7 +4,7 @@ How to contribute to Dolibarr Bug reports and feature requests -------------------------------- -*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). +*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. diff --git a/README.md b/README.md index fbf59a27a74..3f329c678a7 100644 --- a/README.md +++ b/README.md @@ -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...) diff --git a/build/exe/doliwamp/Languages/MyCatalan.isl b/build/exe/doliwamp/Languages/MyCatalan.isl index d8b86eae5ba..b157d1cea27 100644 --- a/build/exe/doliwamp/Languages/MyCatalan.isl +++ b/build/exe/doliwamp/Languages/MyCatalan.isl @@ -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) diff --git a/build/exe/doliwamp/Languages/MySpanish.isl b/build/exe/doliwamp/Languages/MySpanish.isl index 63c0136f351..c31aedf895f 100644 --- a/build/exe/doliwamp/Languages/MySpanish.isl +++ b/build/exe/doliwamp/Languages/MySpanish.isl @@ -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 - \ No newline at end of file +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) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4225dad5f31..dd2593329e0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -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); } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 442d8cf091f..46733575c36 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -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) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 7a436c5a363..c8c082db6ae 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -128,7 +128,7 @@ print ''; -//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 ''."\n"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 3229eda7365..d4664a13de1 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -429,7 +429,7 @@ print ''; -//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 ''."\n"; diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index ce327cc5187..223045db2e9 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -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=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; 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 ''; print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; print ' '; @@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '') global $langs; print ''; - print ''.($title?$title:$langs->trans($confkey)); + print ''.($title ? $title : $langs->trans($confkey)); if (!empty($desc)) { print '
'.$langs->trans($desc).''; } @@ -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 ''; 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 ''; print ''; - if ($type=='textarea') { + if ($type == 'textarea') { print ''; - }elseif($type=='input'){ + }elseif ($type == 'input') { print ''; } - else{ + else { // custom print $type; } diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index d828873be36..0646c7f6d46 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -209,6 +209,8 @@ else // Show examples print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', ''); + print ''.$langs->trans("Format").': '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."
\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); diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index a2db56549e3..4ba581398ee 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -281,8 +281,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).''."\n"; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 73041f6c386..d0a0e79c855 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -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=auserlogin&password=thepassword[&reset=1]'; -$message .= $langs->trans("UrlToGetKeyToUseAPIs").':
'; +$message .= ''.$langs->trans("UrlToGetKeyToUseAPIs").':
'; $message .= img_picto('', 'globe').' '.$url; print $message; print '
'; diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 1216cd67fe7..945a0efdf46 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -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; } /** diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index edb6fdf90c9..56be39a8ad0 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -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) diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 36862e48708..3840f495dea 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -128,12 +128,16 @@ $coldisplay++; print ''; print ''; +$coldisplay++; +print ''; +print ''; + $coldisplay += $colspan; print ''; $coldisplay += $colspan; -print ''; +print ''; print '
'; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index b6197342136..ab0184189a8 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -52,7 +52,7 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print ''.$langs->trans('Description').''; // Qty -print ''.$langs->trans('Qty').''; +print ''.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).''; if ($conf->global->PRODUCT_USE_UNITS) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9c0985078e7..dc451855c0a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -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) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index fb07acbd337..716e02ae678 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -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 ''.$langs->trans("Description").''; 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 ''; @@ -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 ''.$langs->trans("Description").''; // 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 ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8c1e2051a81..fac4dc45715 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -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 .= '
'.$langs->trans('Type').': '.$labeltype; if (!empty($this->location)) $tooltip .= '
'.$langs->trans('Location').': '.$this->location; - if (!empty($this->note)) - $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note) ? str_replace(array("\r", "\n"), "", $this->note) : str_replace(array("\r", "\n"), '
', $this->note)); + if (!empty($this->note_private)) + $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '
', $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; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9f28d278ed1..a4b1a9618fb 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -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 ''; - $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 ''; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 92338ebf68e..85927472c56 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -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; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6a2eac53f95..465bb52033c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b43a702c2f2..4aad42ca44f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -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; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c39a5a05a13..9a13ae1abdf 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bad5034eac5..f230f7935a5 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -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; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ab99173b614..58115537b1f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -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) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index d947d169695..ad75559b362 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -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) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4f111c26f39..89801a357dd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -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 ''; - 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 ''.$langs->trans('RetainedWarranty').''; print '%'; @@ -3413,11 +3413,11 @@ if ($action == 'create') // Retained warranty payment term print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; $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; } } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 205ca88290e..bbb926f7772 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -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) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b6f9c4d7969..d872b02a35d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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").':
'.dol_string_nohtmltag($txttoshow, 1); + //$notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $notetoshow = $langs->trans("ViewPrivateNote").':
'.$txttoshow; $result .= ' '; - $result .= ''; + $result .= ''; $result .= img_picto('', 'note'); $result .= ''; //$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(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index cecc7867b0f..ce948211c46 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -691,6 +691,7 @@ else // Country print ''; + 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 ''; @@ -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 ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; - print ''; + print ''.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; + print ''; + print img_picto('', 'object_phoning'); + print ''; if ($conf->browser->layout == 'phone') print ''; - print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; - print ''; + print ''.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; + print ''; + print img_picto('', 'object_phoning'); + print ''; - print ''.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; - print ''; + print ''.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; + print ''; + print img_picto('', 'object_phoning_mobile'); + print ''; if ($conf->browser->layout == 'phone') print ''; - print ''.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; - print ''; + print ''.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; + print ''; + print img_picto('', 'object_phoning_fax'); + print ''; print ''; 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 ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').''; - print ''; + print ''.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').''; + print ''; + print img_picto('', 'object_email'); + print ''; print ''; if (!empty($conf->mailing->enabled)) @@ -964,12 +975,12 @@ else // Lastname print ''; - print 'lastname).'" autofocus="autofocus">'; + print 'lastname).'" autofocus="autofocus">'; print ''; print ''; // Firstname print ''; - print 'firstname).'">'; + print 'firstname).'">'; print ''; // Company @@ -988,13 +999,13 @@ else print ''; print ''; - print 'poste).'">'; + print 'poste).'">'; // Address print ''; print ''; - print '
'; - print ''; + print '
'; + print ''; print '
'; if ($conf->use_javascript_ajax) print ''.$langs->trans('CopyAddressFromSoc').'
'; print '
'; @@ -1002,13 +1013,14 @@ else // Zip / Town print ' / '; - print $formcompany->select_ziptown((isset($_POST["zipcode"]) ?GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; - 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).' '; + print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print ''; // Country print ''; - 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 ''; @@ -1029,19 +1041,29 @@ else } // Phone - print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).''; - print ''; - print ''.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).''; - print ''; + print ''.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).''; + print ''; + print img_picto('', 'object_phoning'); + print ''; + print ''.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).''; + print ''; + print img_picto('', 'object_phoning'); + print ''; - print ''.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').''; - print ''; - print ''.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; - print ''; + print ''.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').''; + print ''; + print img_picto('', 'object_phoning_mobile'); + print ''; + print ''.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; + print ''; + print img_picto('', 'object_phoning_fax'); + print ''; // EMail - print ''.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; - print ''; + print ''.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; + print ''; + print img_picto('', 'object_email'); + print ''; if (!empty($conf->mailing->enabled)) { $langs->load("mails"); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 7f52195297b..a3cdb1747a0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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++; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 2b7ca20c6e8..0055b0ba428 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -146,14 +146,16 @@ if ($id > 0) $morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2); } + $permtoedit = 0; + $morehtmlref .= '
'; // 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 .= '
'; - $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 .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; @@ -165,7 +167,8 @@ if ($id > 0) if ($user->rights->contrat->creer) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; + $morehtmlref .= ' : '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9d240a31a79..322d309b15b 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -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; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 310aed1cd52..5bf9f1f11c1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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) diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 330db63e30c..7d47b5102ac 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -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 .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; // Project if (!empty($conf->projet->enabled)) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index e8cfa803573..ebae28e9582 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -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; } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a5cb9bf7d35..4bcfbafa9d8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -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; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7bbf7b6475c..3d8871dc07a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -667,7 +667,7 @@ abstract class CommonObject $namecoords .= $this->getFullName($langs, 1).'
'.$coords; // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile $out .= ''; - $out .= img_picto($langs->trans("Address"), 'object_address.png'); + $out .= img_picto($langs->trans("Address"), 'map-marker-alt'); $out .= ' '; } $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; diff --git a/htdocs/core/class/extralanguages.class.php b/htdocs/core/class/extralanguages.class.php index 8f61e84839c..8ae1fd0a4c7 100644 --- a/htdocs/core/class/extralanguages.class.php +++ b/htdocs/core/class/extralanguages.class.php @@ -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; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d4e6620c0da..075fb95066b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -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 } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 8abfe1470d1..726ea5feb78 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 16ecae4298b..507ef0fef08 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 2dcabbcafaa..76e910bdecd 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -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('"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.")"; diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index e99f94aa154..b7933bcf3f4 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -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', diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 0d74fea9b24..a9be157d126 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -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++; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 8a38450697f..c56506eb311 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -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 diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 07074888409..c285f560678 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -7,7 +7,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2019 Pierre Ardoin * * 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); diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 57e4c14e5d5..28b6c6f0dbd 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -284,11 +284,19 @@ if ($line->special_code == 3) { ?> { $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht); $tooltiponprice .= '
'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva); - if (price2num($line->total_localtax1)) $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1); - if (price2num($line->total_localtax2)) $tooltiponprice .= '
'.$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 .= '
'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1); + else $tooltiponprice .= '
'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.$langs->trans("NotUsedForThisCustomer").''; + } + if ($object->thirdparty->useLocalTax(1)) { + if (price2num($line->total_localtax2)) $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax2); + else $tooltiponprice .= '
'.$langs->transcountry("TotalLT2", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.$langs->trans("NotUsedForThisCustomer").''; + } + } $tooltiponprice .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); - print ''; + print ''; } print price($line->total_ht); if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 8260656e4d0..102d7e58685 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -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) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 624add5c075..e1c24106e09 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 48170d68763..f872f05ae47 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -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]; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index f8a62da7ba6..502eb5ccb69 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -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) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e5505cbaa9f..c95e403a24c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 6a7d8a3e8ba..041958448fa 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -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(); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index bc353e7ef0d..8bbee47a2cd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2015-2019 Ferran Marcet * Copyright (C) 2016 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index bc86076644c..f2ab694e352 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -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; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 3605c2b5751..f41e9e3fece 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -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 diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 697c8cb74f0..0b63356480c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 0e7433677ed..4b87b4b9ce3 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_c_shipment_package_type b/htdocs/install/mysql/tables/llx_c_shipment_package_type.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_shipment_package_type rename to htdocs/install/mysql/tables/llx_c_shipment_package_type.sql diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index c6b9049a64f..676e768c73b 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -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 diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 5a2d5464cfc..429095e1111 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -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 diff --git a/htdocs/install/mysql/tables/llx_societe_account.sql b/htdocs/install/mysql/tables/llx_societe_account.sql index feffc7c9bd6..6a78a9a7839 100644 --- a/htdocs/install/mysql/tables/llx_societe_account.sql +++ b/htdocs/install/mysql/tables/llx_societe_account.sql @@ -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, diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c34ea6a9e96..7cb9b21791a 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -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 \ No newline at end of file diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 4e653e04409..d3c4d3253c6 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -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 diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index c3e9870266f..f4d88b0d606 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -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) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 81a8d5e9df7..56b12321bb2 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -475,7 +475,7 @@ if ($id > 0) print '
'; print '
'; - print ''; + print '
'; // Capital if ($action == 'edit') diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 965d49de2f7..86dd2f128e3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -11,6 +11,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2020 Demarest Maxime * * 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 ''."\n".'
'."\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 ''."\n"; + print '
'."\n"; + print '
'."\n"; + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + if (!empty($conf->global->MAIN_INFO_SOCIETE_TEL)) print ''; + if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) print ''; + if (!empty($conf->global->MAIN_INFO_SOCIETE_WEB)) print ''; + print ''; + print '
'; + if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) + print ''; + print '
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).'
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).' '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).'
'.$langs->trans("Phone").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'
'.$langs->trans("Email").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'
'.$langs->trans("Web").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'
'."\n"; + print '
'."\n"; + print ''."\n"; + } + } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 84bf44c84fe..65ba9597b8a 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Lenin Rivas * 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 ''; print ''.$langs->trans('Ref').''; - print ''.$langs->trans('Qty').' ('.$langs->trans("ForAQuantityOf1").')'; + print ''.$langs->trans('Qty').' ('.$langs->trans("ForAQuantityOf", $this->bom->qty).')'; print ''.$langs->trans('QtyFrozen').''; print ''.$langs->trans('DisableStockChange').''; //print ''.$langs->trans('Efficiency').''; @@ -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; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 91f6f75b332..59dd5ed7a7c 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -293,6 +293,7 @@ if ($action == 'create') print ''; $object->lines = $objectbom->lines; + $object->bom = $objectbom; $object->printOriginLinesList('', array()); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 70e248eaf3a..301cf4a76ae 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -684,6 +684,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; if ($action == 'addconsumeline') { + print ''."\n"; print ''; print ''; print ''; print ''; if ($conf->productbatch->enabled) { print ''; @@ -791,6 +792,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $i = 1; + print ''."\n"; print ''; print ''; $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 ''; -print ''; +print ''; print ''; print ''; //print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c37dbaeb3f7..e245ec2cf4e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -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']; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index d57db91aa82..dbdb6cb6f42 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -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 ''; + if ($num == 0) print ''; $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; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 11b901a9c66..0665cc48e06 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -293,13 +293,19 @@ if ($action == 'create') // Country print ''; // Phone / Fax - print ''; - print ''; + print ''; + print ''; + print ''; // Status print '
'; 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 ''; - print ''; + print ''; print '
'.$langs->trans("ToConsume").''; 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 ''.$langs->trans("DisableStockChange").''; } @@ -949,7 +951,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; 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 ''.$langs->trans("NoStockChangeOnServices").''; } diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index abe5dfdb427..6f3b63f6d4e 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -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'); + ?> tpl['strike']) ? '' : ' strikefordisabled').'">'; print ''.$this->tpl['label'].''.$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) : '').''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').''.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').''.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').''.$this->tpl['efficiency'].'
'.$langs->trans("NoMatchFound").'
'.$langs->trans("NoMatchFound").'
'.$langs->trans('Country').''; + 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 '
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''; + print img_picto('', 'object_phoning', 'class="paddingright"'); + print '
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; + print img_picto('', 'object_phoning_fax', 'class="paddingright"'); + print '
'.$langs->trans("Status").''; @@ -395,7 +401,7 @@ else print '
'; print '
'; - print ''; + print '
'; // Parent entrepot $parentwarehouse = new Entrepot($db); @@ -429,7 +435,7 @@ else print '
'; print '
'; - print '
'; + print '
'; // Value print ''; // Phone / Fax - print ''; - print ''; + print ''; + print ''; // Status print '
'.$langs->trans("EstimatedStockValueShort").''; @@ -723,13 +729,18 @@ else // Country print '
'.$langs->trans('Country').''; + 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 '
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''; + print img_picto('', 'object_phoning', 'class="paddingright"'); + print '
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; + print img_picto('', 'object_phoning_fax', 'class="paddingright"'); + print '
'.$langs->trans("Status").''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 40b7c4916de..9f764f7d412 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -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 = ''.$langs->trans("ShowWarehouse").''; + $label = ''.$langs->trans("Warehouse").''; $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref); if (!empty($this->lieu)) { $label .= '
'.$langs->trans('LocationSummary').': '.$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; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 6db4e81db79..f0a5c0a48ea 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -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) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index e2cd50fd2e2..944462ccdfc 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -574,7 +574,7 @@ if ($resql) print '
'; print '
'; - print ''; + print '
'; print ''; @@ -602,7 +602,7 @@ if ($resql) print '
'; print '
'; - print '
'; + print '
'; // Value print ''; @@ -1977,6 +1978,7 @@ else // Country print ''; diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 8d004fa4c79..91f24bbb915 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -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'; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 1100432c854..c50a746c444 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -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"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ea175c13c6a..c35b17fe4fa 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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) diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index f90cb17c230..98bdeffa637 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -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 = ''.$langs->trans("SocieteAccount").''; + $label = ''.$langs->trans("WebsiteAccount").''; $label .= '
'; $label .= ''.$langs->trans('Login').': '.$this->ref; //$label.= '' . $langs->trans('WebSite') . ': ' . $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).'"'; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 7b3bf774a68..dc53f47ff26 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -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; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5910f77a819..ee9f5a1d072 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -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; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 3e69fbc167f..52bb42c4526 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -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) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 89d803781ba..e495a3bb4bc 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -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); diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index e2cd9d339c5..5b9395fbc04 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -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; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 863c0c03072..172309a233e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -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++; } } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f944083f6c5..24bf871af1f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 2cf11c3851f..bc5396e9f51 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -118,12 +118,12 @@ class UserGroup extends CommonObject /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables=array(); + protected $childtables = array(); /** * @var array List of child tables. To know object to delete on cascade. */ - protected $childtablesoncascade = array('usergroup_rights','usergroup_user'); + protected $childtablesoncascade = array('usergroup_rights', 'usergroup_user'); /** @@ -162,7 +162,7 @@ class UserGroup extends CommonObject $this->name = $this->nom; // For compatibility with field name - if($result) + if ($result) { if ($load_members) { diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 8efd7ef38e2..70030dbf1af 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -77,7 +77,7 @@ if (empty($reshook)) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); if ($result > 0) { - $result= $editgroup->addrights($rights, $module, '', $entity); + $result = $editgroup->addrights($rights, $module, '', $entity); if ($result < 0) { setEventMessages($editgroup->error, $editgroup->errors, 'errors'); } diff --git a/htdocs/user/home.php b/htdocs/user/home.php index da037243ed8..4c46c502acc 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -61,7 +61,7 @@ $hookmanager->initHooks(array('userhome')); llxHeader(); -print load_fiche_titre($langs->trans("MenuUsersAndGroups")); +print load_fiche_titre($langs->trans("MenuUsersAndGroups"), '', 'user'); print '
'; @@ -92,7 +92,7 @@ print '
'; /* - * Last created users + * Latest created users */ $max = 10; @@ -128,8 +128,7 @@ if ($resql) print '
'; print '
'.$langs->trans("EstimatedStockValueShort").''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 0e793361d2b..674db2cc5d6 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 6136198fd5e..41f6a76afb2 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -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) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 1269a99d1ea..9c6e8df76f1 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -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 diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 1679f186a72..2bb34859a6b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -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; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 75c6e50dec3..4cda97b39d1 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -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) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 44c25b09a13..82cdf3c80ce 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -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) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 20ada9bfbaf..8800bd887a1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1330,6 +1330,7 @@ else // Country print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; + 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 '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; + 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 '
'; print ''; - print ''; - print ''; + print ''; print ''; $i = 0; @@ -165,7 +164,7 @@ if ($resql) print img_picto($langs->trans("Administrator"), 'star'); } print ""; - print ''; + print ''; print "
'.$langs->trans("LastUsersCreated", min($num, $max)).''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.$obj->login.''.$obj->login.'"; if ($obj->fk_soc) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 32c51d3eef1..0f684ca5232 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -327,8 +327,8 @@ if ($cancel) $savbacktopage = $backtopage; $backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php -if ($sortfield) $backtopage.='&sortfield='.$sortfield; -if ($sortorder) $backtopage.='&sortorder='.$sortorder; +if ($sortfield) $backtopage .= '&sortfield='.$sortfield; +if ($sortorder) $backtopage .= '&sortorder='.$sortorder; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $backtopage = $savbacktopage; @@ -2133,7 +2133,7 @@ print '
'; // Add a margin under toolbar ? $style = ''; -if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && ! GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;'; +if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && !GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;'; if (!GETPOST('hide_websitemenu')) @@ -2437,7 +2437,7 @@ if (!GETPOST('hide_websitemenu')) $preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang); $onlylang = array(); if ($website->otherlang) { - foreach(explode(',', $website->otherlang) as $langkey) { + foreach (explode(',', $website->otherlang) as $langkey) { $onlylang[$langkey] = $langkey; } $textifempty = 1; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 046a5005e51..be0c4c3cc41 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -223,7 +223,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ $linkback = ''; - if ($socid) $linkback = ''.$langs->trans("BackToListOfThirdParty").''; + if ($socid) $linkback = ''.$langs->trans("BackToListForThirdParty").''; if ($fk_website) $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index 6bb7f12250d..34d67341afb 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -140,7 +140,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase $localobject->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $localobject->code = 'AC_PHPUNITTEST'; $localobject->label = 'This is a description'; - $localobject->note = 'This is note'; + $localobject->note_private = 'This is note'; $localobject->fk_project = 0; $localobject->datep = $now; $localobject->datef = $now; diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index f5468d49c4b..2ab2fc2aff3 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -139,7 +139,7 @@ class EntrepotTest extends PHPUnit\Framework\TestCase $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertGreaterThan(0, $result); return $result; } @@ -242,24 +242,4 @@ class EntrepotTest extends PHPUnit\Framework\TestCase return $result; } - - /** - * testEntrepotStatic - * - * @return void - */ - public function testEntrepotStatic() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $localobject=new Entrepot($db); - - //$this->assertLessThan(1, 0); - - return; - } } diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index d095736042b..85137234a3b 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -148,13 +148,13 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase // We create a product for tests $warehouse1=new Entrepot($db); $warehouse1->initAsSpecimen(); - $warehouse1->libelle.=' 1'; + $warehouse1->label.=' 1'; $warehouse1->description.=' 1'; $warehouse1id=$warehouse1->create($user); $warehouse2=new Entrepot($db); $warehouse2->initAsSpecimen(); - $warehouse2->libelle.=' 2'; + $warehouse2->label.=' 2'; $warehouse2->description.=' 2'; $warehouse2id=$warehouse2->create($user);