Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Marc Guenneugues 2020-04-25 10:13:38 +02:00
commit 2f443ebf1d
2405 changed files with 55008 additions and 47522 deletions

View File

@ -4,7 +4,7 @@ How to contribute to Dolibarr
Bug reports and feature requests Bug reports and feature requests
-------------------------------- --------------------------------
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). <a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum).
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues). 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 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... 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. * 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.
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.
* 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: 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). 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 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. 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. 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 ### Resources
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation) [Developer documentation](https://wiki.dolibarr.org/index.php/Developer_documentation)
Translations Translations
------------ ------------
@ -144,11 +145,11 @@ to retreive all old translation of a source text, and restore the translation in
### Resources ### Resources
[Translator documentation](http://wiki.dolibarr.org/index.php/Translator_documentation) [Translator documentation](https://wiki.dolibarr.org/index.php/Translator_documentation)
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. *Note*: to help prevent spam, you need to create an account before being able to edit. Everybody is welcome to contribute to its content.

View File

@ -41,7 +41,7 @@ Ace 1.4.8 BSD Yes
ChartJS 2.9.3 MIT License Yes JS library for graph ChartJS 2.9.3 MIT License Yes JS library for graph
jQuery 3.4.1 MIT License Yes JS library jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)

View File

@ -13,7 +13,7 @@ For Developers or integrators:
- replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';' - remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste - add parameter $pagenavastextinput to value 1 when calling print_barre_liste
* UserGroup class has been refactored with new architecture. Triggers of class UserGroup are now USERGROUP_CREATE, USERGROUP_MODIFY, USERGROUP_DELETE
WARNING: WARNING:

View File

@ -5,7 +5,7 @@
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). 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. 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: 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 - DoliDeb for Debian or Ubuntu
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia - 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. 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 ## UPGRADING
- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr - At first make a backup of your Dolibarr files & 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) ### 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 - Products and/or Services catalog
- Commercial proposals management - Commercial proposals management
- Customer and Supplier Orders management - Customer & Supplier Orders management
- Shipping management
- Warehouse/Stock management
- Invoices and payment management - Invoices and payment management
- Standing orders management (European SEPA) - Standing orders management (European SEPA)
- Bank accounts management - Bank accounts management
- Accounting management - Accounting management
- Shared calendar/agenda (with ical and vcal export for third party tools integration) - Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Opportunities and/or project management - Opportunities and/or project management
- Projects management - Projects & Tasks management
- Contracts management - Contracts management
- Warehouse/Stock management
- Shipping management
- Interventions management - Interventions management
- Employee's leave requests management - Employee's leave requests management
- Expense reports - Expense reports
- Timesheets - Timesheets
- Electronic Document Management (EDM) - Electronic Document Management (EDM)
- Foundations members management - Foundations members management
- Mass emailing
- Surveys
- Point of Sale (POS) - Point of Sale (POS)
- … - …
@ -115,11 +115,13 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Bookmarks management - Bookmarks management
- Donations management - Donations management
- Reporting - Reporting
- Surveys
- Data export/import - Data export/import
- Barcodes support - Barcodes support
- Margin calculations - Margin calculations
- LDAP connectivity - LDAP connectivity
- ClickToDial integration - ClickToDial integration
- Mass emailing
- RSS integration - RSS integration
- Skype integration - Skype integration
- Payment platforms integration (PayPal, Stripe, Paybox...) - Payment platforms integration (PayPal, Stripe, Paybox...)

View File

@ -1,45 +1,47 @@
[CustomMessages] [CustomMessages]
NameAndVersion=%1 versió %2 NameAndVersion=%1 versió %2
AdditionalIcons=Icones addicionals: AdditionalIcons=Icones addicionals:
CreateDesktopIcon=Crea una icona a l'&Escriptori CreateDesktopIcon=Crea una icona a l'&Escriptori
CreateQuickLaunchIcon=Crea una icona a la &Barra de tasques CreateQuickLaunchIcon=Crea una icona a la &Barra de tasques
ProgramOnTheWeb=%1 a Internet ProgramOnTheWeb=%1 a Internet
UninstallProgram=Desinstal·la %1 UninstallProgram=Desinstal·la %1
LaunchProgram=Obre %1 LaunchProgram=Obre %1
AssocFileExtension=&Associa %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... AssocingFileExtension=Associant %1 amb l'extensió de fitxer %2...
YouWillInstallDoliWamp=Va a instal·lar o actualitzar (Apache + Mysql + PHP + Dolibarr) al seu ordinador. YouWillInstallDoliWamp=Instal·laràs DoliWamp (Dolibarr i altres programaris com Apache, Mysql i PHP) al teu 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. 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 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. 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 busca una instal·lació automàtica, es troba en el bon camí... ButIfYouLook=Però si busques una instal·lació automàtica en el teu propi ordinador, et trobes en el bon camí...
DoYouWantToStart=Vol iniciar el procés d'instal·lació/actualització? DoYouWantToStart=Vols iniciar el procés d'instal·lació?
TechnicalParameters=Paràmetres tècnics 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. 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 ; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=Servidor SMTP (El seu o el del seu ISP, únicament primera instal.lació) : SMTPServer=Servidor SMTP (propi o ISP, només primera instal·lació) :
ApachePort=Puerto Apache (únicament primera instal.lació, normalment és el 80) : ApachePort=Port Apache (només primera instal·lació, normalment el 80) :
MySqlPort=Puerto Mysql (únicament primera instal.lació, normalment és el 3306) : MySqlPort=Port MySql (només primera instal·lació, normalment el 3306) :
MySqlPassword=Contrasenya del servidor i la base de dades MySQL de root (únicament primera instal.lació): 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? FirefoxDetected=S'ha detectat Firefox al teu ordinador. El vols utilitzar com a navegador per defecte per Dolibarr?
ChromeDetected=S'ha detectat Chrome al seu ordinador. Voleu activar per defecte com a navegador per Dolibarr? ChromeDetected=S'ha detectat Chrome al teu ordinador. El vols utilitzar com a navegador per defecte per Dolibarr?
ChooseDefaultBrowser=Esculli el seu navegador per defecte. Si no està segur, simplement feu clic a Obrir: 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 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 OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr
DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp.
ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit)

View File

@ -2,7 +2,7 @@
[CustomMessages] [CustomMessages]
NameAndVersion=%1 Version %2 NameAndVersion=%1 Version %2
AdditionalIcons=Zusätzliche Symbole: AdditionalIcons=Zusätzliche Symbole:
CreateDesktopIcon=&Desktop-Symbol erstellen CreateDesktopIcon=&Desktop-Symbol erstellen
CreateQuickLaunchIcon=Symbol in der Schnellstartleiste erstellen CreateQuickLaunchIcon=Symbol in der Schnellstartleiste erstellen
ProgramOnTheWeb=%1 im Internet ProgramOnTheWeb=%1 im Internet
@ -10,3 +10,38 @@ UninstallProgram=%1 entfernen
LaunchProgram=%1 starten LaunchProgram=%1 starten
AssocFileExtension=&Registriere %1 mit der %2-Dateierweiterung AssocFileExtension=&Registriere %1 mit der %2-Dateierweiterung
AssocingFileExtension=%1 wird mit der %2-Dateierweiterung registriert... AssocingFileExtension=%1 wird mit der %2-Dateierweiterung registriert...
YouWillInstallDoliWamp=Sie installieren DoliWamp (also Dolibarr + alle erforderliche Software von Drittanbietern wie Apache, MySQL und PHP) auf Ihrem Computer.
ThisAssistantInstallOrUpgrade=WARNUNG: Die Verwendung eines auf einem lokalen Computer installierten ERP-CRM kann gefährlich sein: Wenn Ihr Computer ausfällt, können Sie alle Ihre Daten verlieren. Tun Sie dies, wenn Sie bereit sind, das Backup selbst ernsthaft zu verwalten. Wenn nicht, verwenden Sie stattdessen eine Installation in Saas (siehe https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Wenn Sie über technische Kenntnisse verfügen und Apache, MySQL und PHP selbst verwalten möchten, sollten Sie diesen Assistenten nicht verwenden und eine manuelle Installation von Dolibarr auf Ihrem vorhandenen Server mit Apache, MySQL und PHP durchführen.
ButIfYouLook=Aber wenn Sie auf Ihrem lokalen Computer nach einer automatischen Einrichtung suchen, sind Sie auf dem besten Weg ...
DoYouWantToStart=Möchten Sie den Installationsprozess starten?
TechnicalParameters=technische Parameter
IfFirstInstall=Geben Sie bei der Erstinstallation einige technische Parameter an. Wenn Sie nicht verstehen, sich nicht sicher sind oder ein Upgrade durchführen, belassen Sie einfach die Standardwerte.
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=SMTP Server (your own or ISP SMTP server, first install only) :
ApachePort=Apache Port (first install only, Standard ist 80) :
MySqlPort=MySQL Port (first install only, Standard ist 3306) :
MySqlPassword=MySQL Server und Datenbank Passwort für root (first install only):
FailedToDeleteLock=Fehler beim Löschen der Datei %1/www/dolibarr/install.lock. Sie können die Warnung ignorieren, müssen sie jedoch möglicherweise später manuell entfernen, wenn Sie dazu aufgefordert werden. Klicken Sie auf OK, um fortzufahren ...
PortAlreadyInUse=Port %1 scheint bereits verwendet zu werden. Sie sollten zurückgehen und einen anderen Wert für %2 Port wählen. Auswahl abbrechen und einen anderen Wert wählen ?
FirefoxDetected=Firefox wurde auf Ihrem Computer erkannt. Möchten Sie ihn als Standardbrowser für Dolibarr verwenden?
ChromeDetected=Chrome wurde auf Ihrem Computer erkannt. Möchten Sie ihn als Standardbrowser für Dolibarr verwenden?
ChooseDefaultBrowser=Bitte wählen Sie Ihren Standardbrowser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). Wenn Sie sich nicht sicher sind, klicken Sie einfach auf Öffnen:
LaunchNow=Starten Sie jetzt Dolibarr
ProgramHasBeenRemoved=Die Dolibarr-Programmdateien wurden entfernt. Alle Ihre Daten befinden sich jedoch noch im Verzeichnis %1. Für eine vollständige Deinstallation, müssen Sie dieses Verzeichnis manuell entfernen.
DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apache und MySQL neu starten. Dies kann nach dieser Bestätigung einige Sekunden bis eine Minute dauern. Wollen Sie mit der Installation oder Aktualisierung des von Dolibarr benötigten Web- und Datenbankservers starten ?
OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden.
OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden.
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen).

View File

@ -1,45 +1,47 @@
[CustomMessages] [CustomMessages]
NameAndVersion=%1 versión %2 NameAndVersion=%1 versión %2
AdditionalIcons=Iconos adicionales: AdditionalIcons=Iconos adicionales:
CreateDesktopIcon=Crear un icono en el &escritorio 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 ProgramOnTheWeb=%1 en la Web
UninstallProgram=Desinstalar %1 UninstallProgram=Desinstalar %1
LaunchProgram=Ejecutar %1 LaunchProgram=Ejecutar %1
AssocFileExtension=&Asociar %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... AssocingFileExtension=Asociando %1 con la extensión de archivo %2...
YouWillInstallDoliWamp=Va a instalar o actualizar (Apache+Mysql+PHP+Dolibarr) en su ordenador. YouWillInstallDoliWamp=Va a instalar DoliWamp (Dolibarr y otro software como Apache, Mysql y PHP) 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. 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. 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... 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/actualización? DoYouWantToStart=¿Quiere iniciar el proceso de instalación?
TechnicalParameters=Parámetros técnicos 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. 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 ; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=Servidor SMTP (El suyo o el de su ISP, únicamente primera instalación) : SMTPServer=Servidor SMTP (propio o su ISP, sólo primera instalación) :
ApachePort=Puerto Apache (únicamente primera instalación, normalmente es el 80) : ApachePort=Puerto Apache (sólo primera instalación, normalmente el 80) :
MySqlPort=Puerto Mysql (únicamente primera instalación, normalmente es el 3306) : MySqlPort=Puerto Mysql (sólo primera instalación, normalmente el 3306) :
MySqlPassword=Contraseña del servidor y la base de datos MySQL de root (únicamente primera instalación): 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 ? 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 ? 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 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 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 OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr
DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp.
ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito)

View File

@ -104,6 +104,27 @@ with
//return false; //return false;
} }
* Replace in tcpdf.php
if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
with
// @CHANGE LDR Add support for src="file://..." links
if (strpos($imgsrc, 'file://') === 0) {
$imgsrc = str_replace('file://', '/', $imgsrc);
$imgsrc = urldecode($imgsrc);
$testscrtype = @parse_url($imgsrc);
if (empty($testscrtype['query'])) {
// convert URL to server path
$imgsrc = str_replace(K_PATH_URL, K_PATH_MAIN, $imgsrc);
} elseif (preg_match('|^https?://|', $imgsrc) !== 1) {
// convert URL to server path
$imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc);
}
}
elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace * In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace
@ -277,3 +298,15 @@ JEDITABLE.JS
* <button type="submit" /> => <button class="button" type="submit" /> * <button type="submit" /> => <button class="button" type="submit" />
* <button type="cancel" /> => <button class="button" type="cancel" /> * <button type="cancel" /> => <button class="button" type="cancel" />
SELECT2
-------
Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: https://github.com/select2/select2/issues/5832
.select2-hidden-accessible {
margin: -1px !important; /* line to restore */
}

File diff suppressed because one or more lines are too long

View File

@ -222,6 +222,9 @@
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" /> <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" /> <rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction">
<severity>0</severity>
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties> <properties>
<property name="equalsSpacing" value="1"/> <property name="equalsSpacing" value="1"/>

View File

@ -332,7 +332,7 @@ if ($resql)
else dol_print_error($db); else dol_print_error($db);
print "</select>"; print "</select>";
print ajax_combobox("chartofaccounts"); print ajax_combobox("chartofaccounts");
print '<input type="'.(empty($conf->use_javascript_ajax)?'submit':'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -357,7 +357,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>'; if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; } if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['aa.reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; }
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthsearch">'; print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@ -371,7 +371,7 @@ if ($resql)
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left '); if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); } if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); }
if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -453,11 +453,11 @@ if ($resql)
if (!empty($arrayfields['aa.reconcilable']['checked'])) { if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="center">'; print '<td class="center">';
if (empty($obj->reconcilable)) { if (empty($obj->reconcilable)) {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=enable&mode=1">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=1">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
} else { } else {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=disable&mode=1">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=1">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>'; print '</a>';
} }
@ -488,11 +488,11 @@ if ($resql)
// Action // Action
print '<td class="center">'; print '<td class="center">';
if ($user->rights->accounting->chartofaccount) { if ($user->rights->accounting->chartofaccount) {
print '<a href="./card.php?action=update&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">'; print '<a class="editfielda" href="./card.php?action=update&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '&nbsp;'; print '&nbsp;';
print '<a href="./card.php?action=delete&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">'; print '<a class="marginleftonly" href="./card.php?action=delete&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
} }

View File

@ -696,7 +696,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -237,8 +237,8 @@ if ($action == 'create') {
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>'; print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
// Label short // Label short
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>'; print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"></td></tr>'; print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"></td></tr>';
// Account parent // Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>'; print '<tr><td>'.$langs->trans("Accountparent").'</td>';
@ -300,8 +300,8 @@ elseif ($id > 0 || $ref) {
print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>'; print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>';
// Label short // Label short
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>'; print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"</td></tr>'; print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"</td></tr>';
// Account parent // Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>'; print '<tr><td>'.$langs->trans("Accountparent").'</td>';
@ -351,8 +351,8 @@ elseif ($id > 0 || $ref) {
print '<td colspan="2">'.$object->label.'</td></tr>'; print '<td colspan="2">'.$object->label.'</td></tr>';
// Label to show // Label to show
print '<tr><td class="titlefield">' . $langs->trans("LabelToShow") . '</td>'; print '<tr><td class="titlefield">'.$langs->trans("LabelToShow").'</td>';
print '<td colspan="2">' . $object->labelshort . '</td></tr>'; print '<td colspan="2">'.$object->labelshort.'</td></tr>';
// Account parent // Account parent
$accp = new AccountingAccount($db); $accp = new AccountingAccount($db);

View File

@ -408,7 +408,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
$titre = $langs->trans($tablib[$id]); $titre = $langs->trans($tablib[$id]);
$linkback = ''; $linkback = '';
$titlepicto = 'title_setup'; $titlepicto = 'title_accountancy';
print load_fiche_titre($titre, $linkback, $titlepicto); print load_fiche_titre($titre, $linkback, $titlepicto);
@ -806,7 +806,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -23,12 +23,12 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta","admin","accountancy")); $langs->loadLangs(array("compta", "admin", "accountancy"));
// Security check // Security check
if (empty($user->rights->accounting->chartofaccount)) { if (empty($user->rights->accounting->chartofaccount)) {
@ -38,7 +38,7 @@ if (empty($user->rights->accounting->chartofaccount)) {
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$list_account_main = array ( $list_account_main = array(
'ACCOUNTING_RESULT_PROFIT', 'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS' 'ACCOUNTING_RESULT_LOSS'
); );
@ -52,23 +52,23 @@ if ($action == 'update') {
$defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha'); $defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha');
if (! empty($defaultjournal)) { if (!empty($defaultjournal)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error ++; $error++;
} }
} else { } else {
$error ++; $error++;
} }
foreach ($list_account_main as $constname) { foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++; $error++;
} }
} }
if (! $error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -91,8 +91,8 @@ print load_fiche_titre($langs->trans('MenuClosureAccounts'), $linkback, 'title_a
print '<span class="opacitymedium">'.$langs->trans("DefaultClosureDesc").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("DefaultClosureDesc").'</span><br>';
print '<br>'; print '<br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
// Define main accounts for closure // Define main accounts for closure
@ -102,14 +102,14 @@ foreach ($list_account_main as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
$keydesc=$key.'_Desc'; $keydesc = $key.'_Desc';
$htmltext = $langs->trans($keydesc); $htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">'; print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext); print $form->textwithpicto($label, $htmltext);
print '</td>'; print '</td>';
// Value // Value
print '<td>'; // Do not force class=right, or it align also the content of the select box print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -117,15 +117,15 @@ foreach ($list_account_main as $key) {
// Journal // Journal
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="50%">' . $langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL") . '</td>'; print '<td width="50%">'.$langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL").'</td>';
print '<td>'; print '<td>';
$defaultjournal=$conf->global->ACCOUNTING_CLOSURE_DEFAULT_JOURNAL; $defaultjournal = $conf->global->ACCOUNTING_CLOSURE_DEFAULT_JOURNAL;
print $formaccounting->select_journal($defaultjournal, "ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0); print $formaccounting->select_journal($defaultjournal, "ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0);
print '</td></tr>'; print '</td></tr>';
print "</table>\n"; print "</table>\n";
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>'; print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
print '</form>'; print '</form>';

View File

@ -274,23 +274,23 @@ if ($action == 'create')
// Label // Label
print '<tr><td class="tdtop">'; print '<tr><td class="tdtop">';
print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); print $form->editfieldkey("Label", 'label', $object->label, $object, 1, 'alpha:32');
print '</td><td colspan="2">'; print '</td><td colspan="2">';
print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); print $form->editfieldval("Label", 'label', $object->label, $object, 1, 'alpha:32');
print "</td></tr>"; print "</td></tr>";
// Date start // Date start
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker');
print '</td><td colspan="2">'; print '</td><td colspan="2">';
print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker');
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker');
print '</td><td colspan="2">'; print '</td><td colspan="2">';
print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker');
print '</td></tr>'; print '</td></tr>';
// Statut // Statut

View File

@ -22,23 +22,23 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","compta")); $langs->loadLangs(array("admin", "compta"));
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->fiscalyear->write) if (!$user->rights->accounting->fiscalyear->write)
accessforbidden(); accessforbidden();
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
// View // View
$title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Info"); $title = $langs->trans("Fiscalyear")." - ".$langs->trans("Info");
$helpurl = ""; $helpurl = "";
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);

View File

@ -236,6 +236,7 @@ if (!empty($user->admin))
} }
print '</tr>'; print '</tr>';
/* Set this option as a hidden option but keep it for some needs.
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>'; print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
@ -248,6 +249,7 @@ if (!empty($user->admin))
print '</a></td>'; print '</a></td>';
} }
print '</tr>'; print '</tr>';
*/
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>'; print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';

View File

@ -657,7 +657,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -362,7 +362,6 @@ if ($result)
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print '<br>'; print '<br>';
@ -412,7 +411,7 @@ if ($result)
//print '<br><div class="center">'.$buttonsave.'</div>'; //print '<br><div class="center">'.$buttonsave.'</div>';
$texte = $langs->trans("ListOfProductsServices"); $texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">'; print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';

View File

@ -1006,7 +1006,7 @@ while ($i < min($num, $limit))
// Amount debit // Amount debit
if (!empty($arrayfields['t.debit']['checked'])) if (!empty($arrayfields['t.debit']['checked']))
{ {
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>'; print '<td class="nowrap right">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
$totalarray['val']['totaldebit'] += $line->debit; $totalarray['val']['totaldebit'] += $line->debit;
@ -1015,7 +1015,7 @@ while ($i < min($num, $limit))
// Amount credit // Amount credit
if (!empty($arrayfields['t.credit']['checked'])) if (!empty($arrayfields['t.credit']['checked']))
{ {
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>'; print '<td class="nowrap right">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit; $totalarray['val']['totalcredit'] += $line->credit;

View File

@ -71,9 +71,9 @@ if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.doc_date,t.rowid"; if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) { if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql.= $db->plimit(1); $sql .= $db->plimit(1);
$res = $db->query($sql); $res = $db->query($sql);
if ($res->num_rows > 0) { if ($res->num_rows > 0) {
@ -220,15 +220,15 @@ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$num=count($object->lines); $num = count($object->lines);
if ($action == 'delmouv') { if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
print $formconfirm; print $formconfirm;
} }
if ($action == 'delbookkeepingyear') { if ($action == 'delbookkeepingyear') {
$form_question = array (); $form_question = array();
$delyear = GETPOST('delyear'); $delyear = GETPOST('delyear');
if (empty($delyear)) { if (empty($delyear)) {
@ -249,7 +249,7 @@ if ($action == 'delbookkeepingyear') {
} }
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -259,11 +259,11 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
@ -335,7 +335,7 @@ while ($i < min($num, $limit))
//if (empty($accountg)) $accountg = '-'; //if (empty($accountg)) $accountg = '-';
// Is it a break ? // Is it a break ?
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) { if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
// Affiche un Sous-Total par compte comptable // Affiche un Sous-Total par compte comptable
if (isset($displayed_account_number)) { if (isset($displayed_account_number)) {
print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
@ -348,7 +348,7 @@ while ($i < min($num, $limit))
$colspan = 9; $colspan = 9;
print "<tr>"; print "<tr>";
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte); if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>'; else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -373,20 +373,20 @@ while ($i < min($num, $limit))
// Affiche un lien vers la facture client/fournisseur // Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>'; print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) :''). '</td>'; print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>'; print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal); $result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">' . $journaltoshow . '</td>'; print '<td class="center">'.$journaltoshow.'</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;'; print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.'">'.img_edit().'</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.'">'.img_delete().'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -27,22 +27,22 @@
* \brief Tab to manage customer lettering * \brief Tab to manage customer lettering
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta","accountancy")); $langs->loadLangs(array("compta", "accountancy"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
@ -139,15 +139,15 @@ dol_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'com
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end(); dol_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code "; $sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )"; $sql .= " WHERE (bk.subledger_account = '".$object->code_compta."' AND bk.numero_compte = '".$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER."' )";
/* /*
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
@ -155,7 +155,7 @@ if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
} }
*/ */
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')'; $sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$debit = 0; $debit = 0;
@ -186,8 +186,8 @@ if (!$resql) {
exit(); exit();
} }
$param=''; $param = '';
$param.="&socid=".urlencode($socid); $param .= "&socid=".urlencode($socid);
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
@ -195,10 +195,10 @@ dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEB
if ($resql) { if ($resql) {
$i = 0; $i = 0;
$param="&socid=".$socid; $param = "&socid=".$socid;
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="socid" value="' . $object->id . '">'; print '<input type="hidden" name="socid" value="'.$object->id.'">';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>'; $letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
@ -250,33 +250,33 @@ if ($resql) {
$solde = 0; $solde = 0;
$tmp = ''; $tmp = '';
while ( $obj = $db->fetch_object($resql) ) { while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
//print '<td>' . $obj->doc_type . '</td>' . "\n"; //print '<td>' . $obj->doc_type . '</td>' . "\n";
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>'; print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
print '<td>' . $obj->doc_ref . '</td>'; print '<td>'.$obj->doc_ref.'</td>';
print '<td>' . $obj->label_compte . '</td>'; print '<td>'.$obj->label_compte.'</td>';
print '<td class="nowrap right">' . price($obj->debit) . '</td>'; print '<td class="nowrap right">'.price($obj->debit).'</td>';
print '<td class="nowrap right">' . price($obj->credit) . '</td>'; print '<td class="nowrap right">'.price($obj->credit).'</td>';
print '<td class="nowrap right">' . price(round($solde, 2)) . '</td>'; print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal // Journal
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal); $result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">' . $journaltoshow . '</td>'; print '<td class="center">'.$journaltoshow.'</td>';
if (empty($obj->lettering_code)) { if (empty($obj->lettering_code)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>'; print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">'; print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit(); print img_edit();
print '</a></td>' . "\n"; print '</a></td>'."\n";
} else { } else {
print '<td class="center">' . $obj->lettering_code . '</td>'; print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>'; print '<td></td>';
} }
@ -284,16 +284,16 @@ if ($resql) {
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n"; print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>'."\n";
print '<td class="nowrap right"><strong>' . price($debit) . '</strong></td>'; print '<td class="nowrap right"><strong>'.price($debit).'</strong></td>';
print '<td class="nowrap right"><strong>' . price($credit) . '</strong></td>'; print '<td class="nowrap right"><strong>'.price($credit).'</strong></td>';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n"; print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>'."\n";
print '<td colspan="2">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
print '<td class="nowrap right"><strong>' . price($credit - $debit) . '</strong></td>'; print '<td class="nowrap right"><strong>'.price($credit - $debit).'</strong></td>';
print '<td colspan="6"></td>'; print '<td colspan="6"></td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -26,22 +26,22 @@
* \brief Tab to setup lettering * \brief Tab to setup lettering
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta","accountancy")); $langs->loadLangs(array("compta", "accountancy"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
@ -67,7 +67,7 @@ $search_doc_ref = GETPOST("search_doc_ref",'alpha');
$lettering = GETPOST('lettering', 'alpha'); $lettering = GETPOST('lettering', 'alpha');
if (!empty($lettering)) { if (!empty($lettering)) {
$action=$lettering; $action = $lettering;
} }
/* /*
@ -138,20 +138,20 @@ dol_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'com
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end(); dol_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated "; $sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )"; $sql .= " WHERE (bk.subledger_account = '".$object->code_compta_fournisseur."' AND bk.numero_compte = '".$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER."' )";
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )"; $sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
} }
$sql.= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')'; $sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql.= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$debit = 0; $debit = 0;
$credit = 0; $credit = 0;
@ -173,17 +173,17 @@ while ($obj = $db->fetch_object($resql)) {
$solde += ($obj->credit - $obj->debit); $solde += ($obj->credit - $obj->debit);
} }
$sql.= $db->plimit($limit+1, $offset); $sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG); dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) { if (!$resql) {
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
$param=''; $param = '';
$param.="&socid=".urlencode($socid); $param .= "&socid=".urlencode($socid);
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
@ -193,10 +193,10 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$param="&socid=".$socid; $param = "&socid=".$socid;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="socid" value="' . $object->id . '">'; print '<input type="hidden" name="socid" value="'.$object->id.'">';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>'; $letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
@ -254,26 +254,26 @@ if ($resql) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
//print '<td>' . $obj->doc_type . '</td>' . "\n"; //print '<td>' . $obj->doc_type . '</td>' . "\n";
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>'; print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
print '<td>' . $obj->doc_ref . '</td>'; print '<td>'.$obj->doc_ref.'</td>';
print '<td>' . $obj->label_compte . '</td>'; print '<td>'.$obj->label_compte.'</td>';
print '<td class="nowrap right">' . price($obj->debit) . '</td>'; print '<td class="nowrap right">'.price($obj->debit).'</td>';
print '<td class="nowrap right">' . price($obj->credit) . '</td>'; print '<td class="nowrap right">'.price($obj->credit).'</td>';
print '<td class="nowrap right">' . price(round($solde, 2)) . '</td>'; print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal // Journal
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal); $result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">' . $journaltoshow . '</td>'; print '<td class="center">'.$journaltoshow.'</td>';
if (empty($obj->lettering_code) && empty($obj->date_validated) ) { if (empty($obj->lettering_code) && empty($obj->date_validated)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>'; print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">'; print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit(); print img_edit();
print '</a></td>' . "\n"; print '</a></td>'."\n";
} else { } else {
print '<td class="center">' . $obj->lettering_code . '</td>'; print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>'; print '<td></td>';
} }
@ -281,16 +281,16 @@ if ($resql) {
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n"; print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>'."\n";
print '<td class="nowrap right"><strong>' . price($debit) . '</strong></td>'; print '<td class="nowrap right"><strong>'.price($debit).'</strong></td>';
print '<td class="nowrap right"><strong>' . price($credit) . '</strong></td>'; print '<td class="nowrap right"><strong>'.price($credit).'</strong></td>';
print '<td colspan="6"></td>'; print '<td colspan="6"></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n"; print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>'."\n";
print '<td colspan="2">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
print '<td class="nowrap right"><strong>' . price($credit - $debit) . '</strong></td>'; print '<td class="nowrap right"><strong>'.price($credit - $debit).'</strong></td>';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -24,7 +24,7 @@
*/ */
// Class // Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
/** /**
* Class to manage categories of an accounting account * Class to manage categories of an accounting account
@ -49,12 +49,12 @@ class AccountancyCategory // extends CommonObject
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element='c_accounting_category'; public $element = 'c_accounting_category';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element='c_accounting_category'; public $table_element = 'c_accounting_category';
/** /**
* @var int ID * @var int ID
@ -150,15 +150,15 @@ class AccountancyCategory // extends CommonObject
public function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error = 0;
// Clean parameters // Clean parameters
if (isset($this->code)) $this->code=trim($this->code); if (isset($this->code)) $this->code = trim($this->code);
if (isset($this->label)) $this->label=trim($this->label); if (isset($this->label)) $this->label = trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account); if (isset($this->range_account)) $this->range_account = trim($this->range_account);
if (isset($this->sens)) $this->sens = (int) $this->sens; if (isset($this->sens)) $this->sens = (int) $this->sens;
if (isset($this->category_type)) $this->category_type = (int) $this->category_type; if (isset($this->category_type)) $this->category_type = (int) $this->category_type;
if (isset($this->formula)) $this->formula=trim($this->formula); if (isset($this->formula)) $this->formula = trim($this->formula);
if (isset($this->position)) $this->position = (int) $this->position; if (isset($this->position)) $this->position = (int) $this->position;
if (isset($this->fk_country)) $this->fk_country = (int) $this->fk_country; if (isset($this->fk_country)) $this->fk_country = (int) $this->fk_country;
if (isset($this->active)) $this->active = (int) $this->active; if (isset($this->active)) $this->active = (int) $this->active;
@ -168,47 +168,47 @@ class AccountancyCategory // extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid, "; if ($this->rowid > 0) $sql .= "rowid, ";
$sql.= "code, "; $sql .= "code, ";
$sql.= "label, "; $sql .= "label, ";
$sql.= "range_account, "; $sql .= "range_account, ";
$sql.= "sens, "; $sql .= "sens, ";
$sql.= "category_type, "; $sql .= "category_type, ";
$sql.= "formula, "; $sql .= "formula, ";
$sql.= "position, "; $sql .= "position, ";
$sql.= "fk_country, "; $sql .= "fk_country, ";
$sql.= "active, "; $sql .= "active, ";
$sql.= "entity"; $sql .= "entity";
$sql.= ") VALUES ("; $sql .= ") VALUES (";
if ($this->rowid > 0) $sql.= " ".$this->rowid.","; if ($this->rowid > 0) $sql .= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").","; $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").",";
$sql.= " ".(! isset($this->range_account)?'NULL':"'".$this->db->escape($this->range_account)."'").","; $sql .= " ".(!isset($this->range_account) ? 'NULL' : "'".$this->db->escape($this->range_account)."'").",";
$sql.= " ".(! isset($this->sens)?'NULL':"'".$this->db->escape($this->sens)."'").","; $sql .= " ".(!isset($this->sens) ? 'NULL' : "'".$this->db->escape($this->sens)."'").",";
$sql.= " ".(! isset($this->category_type)?'NULL':"'".$this->db->escape($this->category_type)."'").","; $sql .= " ".(!isset($this->category_type) ? 'NULL' : "'".$this->db->escape($this->category_type)."'").",";
$sql.= " ".(! isset($this->formula)?'NULL':"'".$this->db->escape($this->formula)."'").","; $sql .= " ".(!isset($this->formula) ? 'NULL' : "'".$this->db->escape($this->formula)."'").",";
$sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).","; $sql .= " ".(!isset($this->position) ? 'NULL' : $this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).","; $sql .= " ".(!isset($this->fk_country) ? 'NULL' : $this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active)); $sql .= " ".(!isset($this->active) ? 'NULL' : $this->db->escape($this->active));
$sql.= ", ".$conf->entity; $sql .= ", ".$conf->entity;
$sql.= ")"; $sql .= ")";
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {
foreach($this->errors as $errmsg) foreach ($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1 * $error;
} }
else else
{ {
@ -229,27 +229,27 @@ class AccountancyCategory // extends CommonObject
public function fetch($id, $code = '', $label = '') public function fetch($id, $code = '', $label = '')
{ {
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql .= " t.rowid,";
$sql.= " t.code,"; $sql .= " t.code,";
$sql.= " t.label,"; $sql .= " t.label,";
$sql.= " t.range_account,"; $sql .= " t.range_account,";
$sql.= " t.sens,"; $sql .= " t.sens,";
$sql.= " t.category_type,"; $sql .= " t.category_type,";
$sql.= " t.formula,"; $sql .= " t.formula,";
$sql.= " t.position,"; $sql .= " t.position,";
$sql.= " t.fk_country,"; $sql .= " t.fk_country,";
$sql.= " t.active"; $sql .= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id; if ($id) $sql .= " WHERE t.rowid = ".$id;
else else
{ {
$sql.= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid $sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
if ($code) $sql.= " AND t.code = '".$this->db->escape($code)."'"; if ($code) $sql .= " AND t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " AND t.label = '".$this->db->escape($label)."'"; elseif ($label) $sql .= " AND t.label = '".$this->db->escape($label)."'";
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
@ -273,7 +273,7 @@ class AccountancyCategory // extends CommonObject
} }
else else
{ {
$this->error="Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
return -1; return -1;
} }
} }
@ -289,15 +289,15 @@ class AccountancyCategory // extends CommonObject
public function update($user = null, $notrigger = 0) public function update($user = null, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error = 0;
// Clean parameters // Clean parameters
if (isset($this->code)) $this->code=trim($this->code); if (isset($this->code)) $this->code = trim($this->code);
if (isset($this->label)) $this->label=trim($this->label); if (isset($this->label)) $this->label = trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account); if (isset($this->range_account)) $this->range_account = trim($this->range_account);
if (isset($this->sens)) $this->sens = (int) $this->sens; if (isset($this->sens)) $this->sens = (int) $this->sens;
if (isset($this->category_type)) $this->category_type = (int) $this->category_type; if (isset($this->category_type)) $this->category_type = (int) $this->category_type;
if (isset($this->formula)) $this->formula=trim($this->formula); if (isset($this->formula)) $this->formula = trim($this->formula);
if (isset($this->position)) $this->position = (int) $this->position; if (isset($this->position)) $this->position = (int) $this->position;
if (isset($this->fk_country)) $this->fk_country = (int) $this->fk_country; if (isset($this->fk_country)) $this->fk_country = (int) $this->fk_country;
if (isset($this->active)) $this->active = (int) $this->active; if (isset($this->active)) $this->active = (int) $this->active;
@ -308,33 +308,33 @@ class AccountancyCategory // extends CommonObject
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."c_accounting_category SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."c_accounting_category SET";
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").","; $sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").",";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").","; $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
$sql.= " range_account=".(isset($this->range_account)?"'".$this->db->escape($this->range_account)."'":"null").","; $sql .= " range_account=".(isset($this->range_account) ? "'".$this->db->escape($this->range_account)."'" : "null").",";
$sql.= " sens=".(isset($this->sens)?$this->sens:"null").","; $sql .= " sens=".(isset($this->sens) ? $this->sens : "null").",";
$sql.= " category_type=".(isset($this->category_type)?$this->category_type:"null").","; $sql .= " category_type=".(isset($this->category_type) ? $this->category_type : "null").",";
$sql.= " formula=".(isset($this->formula)?"'".$this->db->escape($this->formula)."'":"null").","; $sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").",";
$sql.= " position=".(isset($this->position)?$this->position:"null").","; $sql .= " position=".(isset($this->position) ? $this->position : "null").",";
$sql.= " fk_country=".(isset($this->fk_country)?$this->fk_country:"null").","; $sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null").""; $sql .= " active=".(isset($this->active) ? $this->active : "null")."";
$sql.= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {
foreach($this->errors as $errmsg) foreach ($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1 * $error;
} }
else else
{ {
@ -354,27 +354,27 @@ class AccountancyCategory // extends CommonObject
public function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category";
$sql.= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {
foreach($this->errors as $errmsg) foreach ($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1 * $error;
} }
else else
{ {
@ -394,28 +394,28 @@ class AccountancyCategory // extends CommonObject
{ {
global $conf; global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label"; $sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id; $sql .= " WHERE t.fk_accounting_category = ".$id;
$sql .= " AND t.entity = " . $conf->entity; $sql .= " AND t.entity = ".$conf->entity;
$this->lines_display = array(); $this->lines_display = array();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$this->lines_display[] = $obj; $this->lines_display[] = $obj;
} }
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return - 1; return -1;
} }
} }
@ -431,40 +431,40 @@ class AccountancyCategory // extends CommonObject
global $conf; global $conf;
$sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref"; $sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte NOT IN ("; $sql .= " WHERE t.numero_compte NOT IN (";
$sql .= " SELECT t.account_number"; $sql .= " SELECT t.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id . " AND t.entity = " . $conf->entity.")"; $sql .= " WHERE t.fk_accounting_category = ".$id." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN ("; $sql .= " AND t.numero_compte IN (";
$sql .= " SELECT DISTINCT aa.account_number"; $sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity . ")"; $sql .= " AND aa.entity = ".$conf->entity.")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte"; $sql .= " ORDER BY t.numero_compte";
$this->lines_CptBk = array (); $this->lines_CptBk = array();
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj; $this->lines_cptbk[] = $obj;
} }
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return - 1; return -1;
} }
} }
@ -480,34 +480,34 @@ class AccountancyCategory // extends CommonObject
global $conf; global $conf;
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte"; $sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)"; $sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity; $sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label"; $sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label"; $sql .= " ORDER BY aa.account_number, aa.label";
$this->lines_CptBk = array (); $this->lines_CptBk = array();
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj; $this->lines_cptbk[] = $obj;
} }
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return - 1; return -1;
} }
} }
@ -527,42 +527,42 @@ class AccountancyCategory // extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$sql = "SELECT aa.rowid, aa.account_number"; $sql = "SELECT aa.rowid, aa.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity; $sql .= " AND aa.entity = ".$conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql $sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$this->db->begin(); $this->db->begin();
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (!$resql) {
$error ++; $error++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
$accountincptsadded=array(); $accountincptsadded = array();
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$account_number_formated=length_accountg($obj->account_number); $account_number_formated = length_accountg($obj->account_number);
if (! empty($accountincptsadded[$account_number_formated])) continue; if (!empty($accountincptsadded[$account_number_formated])) continue;
if (array_key_exists($account_number_formated, $cpts)) if (array_key_exists($account_number_formated, $cpts))
{ {
$accountincptsadded[$account_number_formated]=1; $accountincptsadded[$account_number_formated] = 1;
// We found an account number that is in list $cpts of account to add // We found an account number that is in list $cpts of account to add
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
$sql .= " SET fk_accounting_category=" . $id_cat; $sql .= " SET fk_accounting_category=".$id_cat;
$sql .= " WHERE rowid=".$obj->rowid; $sql .= " WHERE rowid=".$obj->rowid;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resqlupdate = $this->db->query($sql); $resqlupdate = $this->db->query($sql);
if (! $resqlupdate) { if (!$resqlupdate) {
$error ++; $error++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
} }
} }
@ -570,12 +570,12 @@ class AccountancyCategory // extends CommonObject
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return - 1 * $error; return -1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
@ -594,27 +594,27 @@ class AccountancyCategory // extends CommonObject
{ {
$error = 0; $error = 0;
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " SET fk_accounting_category= 0"; $sql .= " SET fk_accounting_category= 0";
$sql .= " WHERE aa.rowid= " . $cpt_id; $sql .= " WHERE aa.rowid= ".$cpt_id;
$this->db->begin(); $this->db->begin();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (!$resql) {
$error ++; $error++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return - 1 * $error; return -1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
@ -637,14 +637,14 @@ class AccountancyCategory // extends CommonObject
} }
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens "; $sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; $sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1"; $sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity; $sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category"; $sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = " . $conf->entity; $sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY cat.position ASC"; $sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -652,11 +652,11 @@ class AccountancyCategory // extends CommonObject
$i = 0; $i = 0;
$obj = ''; $obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$data = array (); $data = array();
if ($num) { if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$name_cat = $obj->name_cat; $name_cat = $obj->name_cat;
$data[$name_cat][$i] = array ( $data[$name_cat][$i] = array(
'id' => $obj->rowid, 'id' => $obj->rowid,
'code' => $obj->code, 'code' => $obj->code,
'position' => $obj->position, 'position' => $obj->position,
@ -664,13 +664,13 @@ class AccountancyCategory // extends CommonObject
'account_label' => $obj->account_label, 'account_label' => $obj->account_label,
'sens' => $obj->sens 'sens' => $obj->sens
); );
$i ++; $i++;
} }
} }
return $data; return $data;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1; return -1;
} }
@ -696,34 +696,34 @@ class AccountancyCategory // extends CommonObject
$this->sdcpermonth = array(); $this->sdcpermonth = array();
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
if (is_array($cpt)) $sql.=", t.numero_compte as accountancy_account"; if (is_array($cpt)) $sql .= ", t.numero_compte as accountancy_account";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
//if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date'; //if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
$sql .= " WHERE t.entity = ".$conf->entity; $sql .= " WHERE t.entity = ".$conf->entity;
if (is_array($cpt)) if (is_array($cpt))
{ {
$listofaccount=''; $listofaccount = '';
foreach($cpt as $cptcursor) foreach ($cpt as $cptcursor)
{ {
if ($listofaccount) $listofaccount.=","; if ($listofaccount) $listofaccount .= ",";
$listofaccount.="'".$cptcursor."'"; $listofaccount .= "'".$cptcursor."'";
} }
$sql .= " AND t.numero_compte IN (" .$listofaccount. ")"; $sql .= " AND t.numero_compte IN (".$listofaccount.")";
} }
else else
{ {
$sql .= " AND t.numero_compte = '" . $this->db->escape($cpt) . "'"; $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
} }
if (! empty($date_start) && ! empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate($date_start)."' AND '".$this->db->idate($date_end)."')"; $sql .= " AND (t.doc_date BETWEEN '".$this->db->idate($date_start)."' AND '".$this->db->idate($date_end)."')";
if (! empty($month) && ! empty($year)) { if (!empty($month) && !empty($year)) {
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."')"; $sql .= " AND (t.doc_date BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."')";
} }
if ($thirdparty_code != 'nofilter') if ($thirdparty_code != 'nofilter')
{ {
$sql .= " AND t.thirdparty_code = '".$this->db->escape($thirdparty_code)."'"; $sql .= " AND t.thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
} }
if (is_array($cpt)) $sql.=" GROUP BY t.numero_compte"; if (is_array($cpt)) $sql .= " GROUP BY t.numero_compte";
//print $sql; //print $sql;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -745,9 +745,9 @@ class AccountancyCategory // extends CommonObject
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }
@ -768,10 +768,10 @@ class AccountancyCategory // extends CommonObject
} }
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1"; $sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity; $sql .= " AND c.entity = ".$conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1"; if ($categorytype >= 0) $sql .= " AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " ORDER BY c.position ASC"; $sql .= " ORDER BY c.position ASC";
@ -780,12 +780,12 @@ class AccountancyCategory // extends CommonObject
$i = 0; $i = 0;
$obj = ''; $obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$data = array (); $data = array();
if ($num) { if ($num) {
while ( $i < $num ) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$data[] = array ( $data[] = array(
'rowid' => $obj->rowid, 'rowid' => $obj->rowid,
'code' => $obj->code, 'code' => $obj->code,
'label' => $obj->label, 'label' => $obj->label,
@ -799,11 +799,11 @@ class AccountancyCategory // extends CommonObject
} }
return $data; return $data;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
return - 1; return -1;
} }
} }
@ -826,20 +826,20 @@ class AccountancyCategory // extends CommonObject
exit(); exit();
} }
if (! empty($cat_id)) if (!empty($cat_id))
{ {
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " AND t.entity = " . $conf->entity; $sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
else else
{ {
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere; $sql .= " WHERE ".$predefinedgroupwhere;
$sql .= " AND t.entity = " . $conf->entity; $sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
//echo $sql; //echo $sql;
@ -853,7 +853,7 @@ class AccountancyCategory // extends CommonObject
if ($num) { if ($num) {
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$data[] = array ( $data[] = array(
'id' => $obj->rowid, 'id' => $obj->rowid,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'account_label' => $obj->account_label, 'account_label' => $obj->account_label,
@ -863,8 +863,8 @@ class AccountancyCategory // extends CommonObject
} }
return $data; return $data;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1; return -1;
} }

View File

@ -1079,28 +1079,28 @@ class AccountancyExport
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
// TYPE C // TYPE C
if($last_codeinvoice != $line->doc_ref){ if ($last_codeinvoice != $line->doc_ref) {
//recherche societe en fonction de son code client //recherche societe en fonction de son code client
$sql = "SELECT code_client, fk_forme_juridique, nom, address, zip, town, fk_pays, phone, siret FROM ".MAIN_DB_PREFIX."societe WHERE code_client = '".$line->thirdparty_code ."'"; $sql = "SELECT code_client, fk_forme_juridique, nom, address, zip, town, fk_pays, phone, siret FROM ".MAIN_DB_PREFIX."societe WHERE code_client = '".$line->thirdparty_code."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if($resql && $this->db->num_rows($resql)>0) if ($resql && $this->db->num_rows($resql) > 0)
{ {
$soc = $this->db->fetch_object($resql); $soc = $this->db->fetch_object($resql);
$address=array('','',''); $address = array('', '', '');
if (strpos($soc->address, "\n")!==false) { if (strpos($soc->address, "\n") !== false) {
$address = explode("\n", $soc->address); $address = explode("\n", $soc->address);
if (is_array($address) && count($address)>0) { if (is_array($address) && count($address) > 0) {
foreach($address as $key=>$data) { foreach ($address as $key=>$data) {
$address[$key]=str_replace(array("\t", "\n", "\r"), "", $data); $address[$key] = str_replace(array("\t", "\n", "\r"), "", $data);
$address[$key]=dol_trunc($address[$key], 40, 'right', 'UTF-8', 1); $address[$key] = dol_trunc($address[$key], 40, 'right', 'UTF-8', 1);
} }
} }
} else { } else {
$address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40); $address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40);
$address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40); $address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40);
$address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40); $address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40);
} }
$type_enregistrement = 'C'; $type_enregistrement = 'C';
@ -1254,7 +1254,7 @@ class AccountancyExport
$racine_subledger_account = ''; // for records of type E leave this field blank $racine_subledger_account = ''; // for records of type E leave this field blank
// } // }
print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
// MONT // MONT
print price(abs($line->montant), 0, '', 1, 2).$separator; print price(abs($line->montant), 0, '', 1, 2).$separator;
// CODC // CODC

View File

@ -98,15 +98,15 @@ class AccountancySystem
if ($rowid > 0 || $ref) if ($rowid > 0 || $ref)
{ {
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active"; $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " WHERE"; $sql .= " WHERE";
if ($rowid) { if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'"; $sql .= " a.rowid = '".$rowid."'";
} elseif ($ref) { } elseif ($ref) {
$sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'"; $sql .= " a.pcg_version = '".$this->db->escape($ref)."'";
} }
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -124,11 +124,11 @@ class AccountancySystem
return 0; return 0;
} }
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
} }
return - 1; return -1;
} }
@ -142,14 +142,14 @@ class AccountancySystem
{ {
$now = dol_now(); $now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system";
$sql .= " (date_creation, fk_user_author, numero, label)"; $sql .= " (date_creation, fk_user_author, numero, label)";
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->db->escape($this->numero) . "','" . $this->db->escape($this->label) . "')"; $sql .= " VALUES ('".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->numero)."','".$this->db->escape($this->label)."')";
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system"); $id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_system");
if ($id > 0) { if ($id > 0) {
$this->rowid = $id; $this->rowid = $id;

View File

@ -34,12 +34,12 @@ class AccountingAccount extends CommonObject
/** /**
* @var string Name of element * @var string Name of element
*/ */
public $element='accounting_account'; public $element = 'accounting_account';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element='accounting_account'; public $table_element = 'accounting_account';
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
@ -150,7 +150,7 @@ class AccountingAccount extends CommonObject
global $conf; global $conf;
$this->db = $db; $this->db = $db;
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method $this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; // Used to add a filter in Form::showrefnav method
} }
/** /**
@ -169,23 +169,23 @@ class AccountingAccount extends CommonObject
if ($rowid || $account_number) { if ($rowid || $account_number) {
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable"; $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable";
$sql .= ", ca.label as category_label"; $sql .= ", ca.label as category_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
$sql .= " WHERE"; $sql .= " WHERE";
if ($rowid) { if ($rowid) {
$sql .= " a.rowid = " . (int) $rowid; $sql .= " a.rowid = ".(int) $rowid;
} elseif ($account_number) { } elseif ($account_number) {
$sql .= " a.account_number = '" . $this->db->escape($account_number) . "'"; $sql .= " a.account_number = '".$this->db->escape($account_number)."'";
$sql .= " AND a.entity = ".$conf->entity; $sql .= " AND a.entity = ".$conf->entity;
} }
if (! empty($limittocurrentchart)) { if (!empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')';
} }
if (! empty($limittoachartaccount)) { if (!empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
} }
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -215,8 +215,8 @@ class AccountingAccount extends CommonObject
return 0; return 0;
} }
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
} }
return -1; return -1;
@ -255,7 +255,7 @@ class AccountingAccount extends CommonObject
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_account(";
$sql .= "datec"; $sql .= "datec";
$sql .= ", entity"; $sql .= ", entity";
$sql .= ", fk_pcg_version"; $sql .= ", fk_pcg_version";
@ -269,31 +269,31 @@ class AccountingAccount extends CommonObject
$sql .= ", active"; $sql .= ", active";
$sql .= ", reconcilable"; $sql .= ", reconcilable";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= " '" . $this->db->idate($now) . "'"; $sql .= " '".$this->db->idate($now)."'";
$sql .= ", " . $conf->entity; $sql .= ", ".$conf->entity;
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'"); $sql .= ", ".(empty($this->fk_pcg_version) ? 'NULL' : "'".$this->db->escape($this->fk_pcg_version)."'");
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); $sql .= ", ".(empty($this->pcg_type) ? 'NULL' : "'".$this->db->escape($this->pcg_type)."'");
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'"); $sql .= ", ".(empty($this->account_number) ? 'NULL' : "'".$this->db->escape($this->account_number)."'");
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent); $sql .= ", ".(empty($this->account_parent) ? 0 : (int) $this->account_parent);
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'"); $sql .= ", ".(empty($this->label) ? "''" : "'".$this->db->escape($this->label)."'");
$sql .= ", " . (empty($this->labelshort) ? "''" : "'" . $this->db->escape($this->labelshort) . "'"); $sql .= ", ".(empty($this->labelshort) ? "''" : "'".$this->db->escape($this->labelshort)."'");
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= ", ".(empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", " . $user->id; $sql .= ", ".$user->id;
$sql .= ", " . (int) $this->active; $sql .= ", ".(int) $this->active;
$sql .= ", " . (int) $this->reconcilable; $sql .= ", ".(int) $this->reconcilable;
$sql .= ")"; $sql .= ")";
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
if (! $error) { if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_account");
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger. // want this action to call a trigger.
@ -309,8 +309,8 @@ class AccountingAccount extends CommonObject
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return -1 * $error;
@ -336,20 +336,20 @@ class AccountingAccount extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null"); $sql .= " SET fk_pcg_version = ".($this->fk_pcg_version ? "'".$this->db->escape($this->fk_pcg_version)."'" : "null");
$sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null"); $sql .= " , pcg_type = ".($this->pcg_type ? "'".$this->db->escape($this->pcg_type)."'" : "null");
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'"; $sql .= " , account_number = '".$this->db->escape($this->account_number)."'";
$sql .= " , account_parent = " . (int) $this->account_parent; $sql .= " , account_parent = ".(int) $this->account_parent;
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''"); $sql .= " , label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "''");
$sql .= " , labelshort = " . ($this->labelshort ? "'" . $this->db->escape($this->labelshort) . "'" : "''"); $sql .= " , labelshort = ".($this->labelshort ? "'".$this->db->escape($this->labelshort)."'" : "''");
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= " , fk_accounting_category = ".(empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= " , fk_user_modif = " . $user->id; $sql .= " , fk_user_modif = ".$user->id;
$sql .= " , active = " . (int) $this->active; $sql .= " , active = ".(int) $this->active;
$sql .= " , reconcilable = " . (int) $this->reconcilable; $sql .= " , reconcilable = ".(int) $this->reconcilable;
$sql .= " WHERE rowid = " . $this->id; $sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->db->commit(); $this->db->commit();
@ -357,7 +357,7 @@ class AccountingAccount extends CommonObject
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return - 1; return -1;
} }
} }
@ -370,13 +370,13 @@ class AccountingAccount extends CommonObject
{ {
global $langs; global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; $sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet";
$sql.= " WHERE fk_code_ventilation=" . $this->id . ")"; $sql .= " WHERE fk_code_ventilation=".$this->id.")";
$sql.= "UNION"; $sql .= "UNION";
$sql.= " (SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " (SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facture_fourn_det";
$sql.= " WHERE fk_code_ventilation=" . $this->id . ")"; $sql .= " WHERE fk_code_ventilation=".$this->id.")";
dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::checkUsage sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
@ -389,7 +389,7 @@ class AccountingAccount extends CommonObject
} }
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
return - 1; return -1;
} }
} }
@ -409,32 +409,32 @@ class AccountingAccount extends CommonObject
if ($result > 0) { if ($result > 0) {
$this->db->begin(); $this->db->begin();
if (! $error) { if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."accounting_account";
$sql .= " WHERE rowid=" . $this->id; $sql .= " WHERE rowid=".$this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql); dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (!$resql) {
$error ++; $error++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return - 1 * $error; return -1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} else { } else {
return - 1; return -1;
} }
} }
@ -455,19 +455,19 @@ class AccountingAccount extends CommonObject
global $langs, $conf, $user; global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
$result = ''; $result = '';
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id; $url = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$this->id;
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
$picto = 'billr'; $picto = 'billr';
$label=''; $label = '';
if (empty($this->labelshort) || $withcompletelabel == 1) if (empty($this->labelshort) || $withcompletelabel == 1)
{ {
@ -476,28 +476,28 @@ class AccountingAccount extends CommonObject
$labeltoshow = $this->labelshort; $labeltoshow = $this->labelshort;
} }
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>'; $label = '<u>'.$langs->trans("ShowAccountingAccount").'</u>';
if (! empty($this->account_number)) if (!empty($this->account_number))
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number); $label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);
if (! empty($labeltoshow)) if (!empty($labeltoshow))
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $labeltoshow; $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
if ($moretitle) $label.=' - '.$moretitle; if ($moretitle) $label .= ' - '.$moretitle;
$linkclose=''; $linkclose = '';
if (empty($notooltip)) if (empty($notooltip))
{ {
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label=$langs->trans("ShowAccoutingAccount"); $label = $langs->trans("ShowAccoutingAccount");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"'; $linkclose .= ' class="classfortooltip"';
} }
$linkstart='<a href="'.$url.'"'; $linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>'; $linkstart .= $linkclose.'>';
$linkend='</a>'; $linkend = '</a>';
if ($nourl) if ($nourl)
{ {
@ -507,11 +507,11 @@ class AccountingAccount extends CommonObject
} }
$label_link = length_accountg($this->account_number); $label_link = length_accountg($this->account_number);
if ($withlabel) $label_link .= ' - ' . ($nourl ? '<span class="opacitymedium">' : '').$labeltoshow.($nourl ? '</span>' : ''); if ($withlabel) $label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$labeltoshow.($nourl ? '</span>' : '');
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto) $result .= ($linkstart.img_object(($notooltip ? '' : $label), $picto, ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).$linkend);
if ($withpicto && $withpicto != 2) $result .= ' '; if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend; if ($withpicto != 2) $result .= $linkstart.$label_link.$linkend;
return $result; return $result;
} }
@ -524,10 +524,10 @@ class AccountingAccount extends CommonObject
public function info($id) public function info($id)
{ {
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; $sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a';
$sql .= ' WHERE a.rowid = ' . $id; $sql .= ' WHERE a.rowid = '.$id;
dol_syslog(get_class($this) . '::info sql=' . $sql); dol_syslog(get_class($this).'::info sql='.$sql);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
@ -578,11 +578,11 @@ class AccountingAccount extends CommonObject
if ($result > 0) { if ($result > 0) {
$this->db->begin(); $this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET " . $fieldtouse . " = '0'"; $sql .= "SET ".$fieldtouse." = '0'";
$sql .= " WHERE rowid = " . $this->db->escape($id); $sql .= " WHERE rowid = ".$this->db->escape($id);
dol_syslog(get_class($this) . "::account_desactivate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::account_desactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
@ -591,10 +591,10 @@ class AccountingAccount extends CommonObject
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return - 1; return -1;
} }
} else { } else {
return - 1; return -1;
} }
} }
@ -620,11 +620,11 @@ class AccountingAccount extends CommonObject
$fieldtouse = 'reconcilable'; $fieldtouse = 'reconcilable';
} }
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET " . $fieldtouse . " = '1'"; $sql .= "SET ".$fieldtouse." = '1'";
$sql .= " WHERE rowid = " . $this->db->escape($id); $sql .= " WHERE rowid = ".$this->db->escape($id);
dol_syslog(get_class($this) . "::account_activate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->db->commit(); $this->db->commit();
@ -632,7 +632,7 @@ class AccountingAccount extends CommonObject
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return - 1; return -1;
} }
} }

View File

@ -361,20 +361,20 @@ class BookKeeping extends CommonObject
$sql .= ", '".$this->db->escape($this->doc_ref)."'"; $sql .= ", '".$this->db->escape($this->doc_ref)."'";
$sql .= ", ".$this->fk_doc; $sql .= ", ".$this->fk_doc;
$sql .= ", ".$this->fk_docdet; $sql .= ", ".$this->fk_docdet;
$sql .= ", ".(!empty($this->thirdparty_code)?("'".$this->db->escape($this->thirdparty_code)."'"):"NULL"); $sql .= ", ".(!empty($this->thirdparty_code) ? ("'".$this->db->escape($this->thirdparty_code)."'") : "NULL");
$sql .= ", ".(!empty($this->subledger_account)?("'".$this->db->escape($this->subledger_account)."'"):"NULL"); $sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL");
$sql .= ", ".(!empty($this->subledger_label)?("'".$this->db->escape($this->subledger_label)."'"):"NULL"); $sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->numero_compte)."'"; $sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ", ".(!empty($this->label_operation)?("'".$this->db->escape($this->label_operation)."'"):"NULL"); $sql .= ", ".(!empty($this->label_operation) ? ("'".$this->db->escape($this->label_operation)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'"; $sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit; $sql .= ", ".$this->debit;
$sql .= ", ".$this->credit; $sql .= ", ".$this->credit;
$sql .= ", ".$this->montant; $sql .= ", ".$this->montant;
$sql .= ", ".(!empty($this->sens)?("'".$this->db->escape($this->sens)."'"):"NULL"); $sql .= ", ".(!empty($this->sens) ? ("'".$this->db->escape($this->sens)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->fk_user_author)."'"; $sql .= ", '".$this->db->escape($this->fk_user_author)."'";
$sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->code_journal)."'"; $sql .= ", '".$this->db->escape($this->code_journal)."'";
$sql .= ", ".(!empty($this->journal_label)?("'".$this->db->escape($this->journal_label)."'"):"NULL"); $sql .= ", ".(!empty($this->journal_label) ? ("'".$this->db->escape($this->journal_label)."'") : "NULL");
$sql .= ", ".$this->db->escape($this->piece_num); $sql .= ", ".$this->db->escape($this->piece_num);
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity); $sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
$sql .= ")"; $sql .= ")";
@ -1397,7 +1397,7 @@ class BookKeeping extends CommonObject
$sql = "DELETE"; $sql = "DELETE";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE 1 = 1"; $sql .= " WHERE 1 = 1";
$sql.= dolSqlDateFilter('doc_date', 0, $delmonth, $delyear); $sql .= dolSqlDateFilter('doc_date', 0, $delmonth, $delyear);
if (!empty($journal)) $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; if (!empty($journal)) $sql .= " AND code_journal = '".$this->db->escape($journal)."'";
$sql .= " AND entity IN (".getEntity('accountancy').")"; $sql .= " AND entity IN (".getEntity('accountancy').")";

View File

@ -24,9 +24,9 @@
* \brief File of class for lettering * \brief File of class for lettering
*/ */
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php"; include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; include_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php"; include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
/** /**
* Class Lettering * Class Lettering
@ -64,15 +64,15 @@ class Lettering extends BookKeeping
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.subledger_account, "; $sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.subledger_account, ";
$sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant "; $sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant ";
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type "; $sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
$sql .= " WHERE ( "; $sql .= " WHERE ( ";
if ($object->code_compta != "") if ($object->code_compta != "")
$sql .= " bk.subledger_account = '" . $object->code_compta . "' "; $sql .= " bk.subledger_account = '".$object->code_compta."' ";
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") if ($object->code_compta != "" && $object->code_compta_fournisseur != "")
$sql .= " OR "; $sql .= " OR ";
if ($object->code_compta_fournisseur != "") if ($object->code_compta_fournisseur != "")
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; $sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) "; $sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) "; $sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
@ -85,127 +85,127 @@ class Lettering extends BookKeeping
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$ids = array(); $ids = array();
$ids_fact = array(); $ids_fact = array();
if ($obj->type == 'payment_supplier') if ($obj->type == 'payment_supplier')
{ {
$sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id'; $sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id';
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn facf ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='" . $obj->code_journal . "')"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='".$obj->code_journal."')";
$sql .= " WHERE payfacf.fk_paiementfourn = '" . $obj->url_id . "' "; $sql .= " WHERE payfacf.fk_paiementfourn = '".$obj->url_id."' ";
$sql .= " AND facf.entity = ".$conf->entity; $sql .= " AND facf.entity = ".$conf->entity;
$sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; $sql .= " AND code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
$sql .= " AND ( "; $sql .= " AND ( ";
if ($object->code_compta != "") { if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' "; $sql .= " bk.subledger_account = '".$object->code_compta."' ";
} }
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR "; $sql .= " OR ";
} }
if ($object->code_compta_fournisseur != "") { if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; $sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
} }
$sql .= " ) "; $sql .= " ) ";
$resql2 = $this->db->query($sql); $resql2 = $this->db->query($sql);
if ($resql2) { if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) { while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
$ids_fact[] = $obj2->fact_id; $ids_fact[] = $obj2->fact_id;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return -1;
} }
if (count($ids_fact)) { if (count($ids_fact)) {
$sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier '; $sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier ';
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn facf ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (" . implode(',', $ids_fact) . "))"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (".implode(',', $ids_fact)."))";
$sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3 AND entity=".$conf->entity.") "; $sql .= " WHERE bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=3 AND entity=".$conf->entity.") ";
$sql .= " AND facf.entity = ".$conf->entity; $sql .= " AND facf.entity = ".$conf->entity;
$sql .= " AND ( "; $sql .= " AND ( ";
if ($object->code_compta != "") { if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' "; $sql .= " bk.subledger_account = '".$object->code_compta."' ";
} }
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR "; $sql .= " OR ";
} }
if ($object->code_compta_fournisseur != "") { if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; $sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
} }
$sql .= ") "; $sql .= ") ";
$resql2 = $this->db->query($sql); $resql2 = $this->db->query($sql);
if ($resql2) { if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) { while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return -1;
} }
} }
} elseif ($obj->type == 'payment') { } elseif ($obj->type == 'payment') {
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id'; $sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sql .= " FROM ".MAIN_DB_PREFIX."facture fac ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiement as pay ON payfac.fk_paiement=pay.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='" . $obj->code_journal . "')"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='".$obj->code_journal."')";
$sql .= " WHERE payfac.fk_paiement = '" . $obj->url_id . "' "; $sql .= " WHERE payfac.fk_paiement = '".$obj->url_id."' ";
$sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; $sql .= " AND bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
$sql .= " AND fac.entity IN (".getEntity('invoice', 0).")";// We don't share object for accountancy $sql .= " AND fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND ( "; $sql .= " AND ( ";
if ($object->code_compta != "") { if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' "; $sql .= " bk.subledger_account = '".$object->code_compta."' ";
} }
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR "; $sql .= " OR ";
} }
if ($object->code_compta_fournisseur != "") { if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; $sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
} }
$sql .= " ) "; $sql .= " )";
$resql2 = $this->db->query($sql); $resql2 = $this->db->query($sql);
if ($resql2) { if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) { while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
$ids_fact[] = $obj2->fact_id; $ids_fact[] = $obj2->fact_id;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return -1;
} }
if (count($ids_fact)) { if (count($ids_fact)) {
$sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier '; $sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier ';
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sql .= " FROM ".MAIN_DB_PREFIX."facture fac ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (" . implode(',', $ids_fact) . "))"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (".implode(',', $ids_fact)."))";
$sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2 AND entity=".$conf->entity.") "; $sql .= " WHERE code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=2 AND entity=".$conf->entity.") ";
$sql .= " AND fac.entity IN (".getEntity('invoice', 0).")";// We don't share object for accountancy $sql .= " AND fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND ( "; $sql .= " AND ( ";
if ($object->code_compta != "") { if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' "; $sql .= " bk.subledger_account = '".$object->code_compta."' ";
} }
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR "; $sql .= " OR ";
} }
if ($object->code_compta_fournisseur != "") { if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; $sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
} }
$sql .= " ) "; $sql .= " ) ";
$resql2 = $this->db->query($sql); $resql2 = $this->db->query($sql);
if ($resql2) { if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) { while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return -1;
} }
} }
} }
@ -217,10 +217,10 @@ class Lettering extends BookKeeping
} }
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::" . __METHOD__ . $errmsg, LOG_ERR); dol_syslog(__METHOD__.' '.$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
return - 1 * $error; return -1 * $error;
} else { } else {
return 1; return 1;
} }
@ -237,33 +237,31 @@ class Lettering extends BookKeeping
$error = 0; $error = 0;
$lettre = 'AAA'; $lettre = 'AAA';
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $sql = "SELECT DISTINCT lettering_code FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
$sql = "SELECT DISTINCT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
$sql .= " lettering_code != '' ORDER BY lettering_code DESC limit 1; "; $sql .= " lettering_code != '' ORDER BY lettering_code DESC limit 1; ";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code); $lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
if (! empty($obj->lettering_code)) if (!empty($obj->lettering_code))
$lettre++; $lettre++;
} else { } else {
$this->errors[] = 'Error' . $this->db->lasterror(); $this->errors[] = 'Error'.$this->db->lasterror();
$error++; $error++;
} }
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE "; $sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
$sql .= " rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL "; $sql .= " rowid IN (".implode(',', $ids).") AND date_validated IS NULL ";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) { if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2); $this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
$error++; $error++;
} }
} else { } else {
$this->errors[] = 'Erreur sql' . $this->db->lasterror(); $this->errors[] = 'Erreur sql'.$this->db->lasterror();
$error++; $error++;
} }
@ -271,30 +269,30 @@ class Lettering extends BookKeeping
$now = dol_now(); $now = dol_now();
if (! $error) if (!$error)
{ {
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
$sql .= " lettering_code='" . $lettre . "'"; $sql .= " lettering_code='".$lettre."'";
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false $sql .= " , date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL "; $sql .= " WHERE rowid IN (".implode(',', $ids).") AND date_validated IS NULL ";
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR); dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return - 1 * $error; return -1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;

View File

@ -167,7 +167,7 @@ if ($action == 'validatehistory') {
$suggestedaccountingaccountfor = 'eecwithvat'; $suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = 0; // There is a doubt, no automatic binding $objp->aarowid_suggest = 0; // There is a doubt, no automatic binding
$suggestedaccountingaccountfor = 'eecwithoutvatnumber'; $suggestedaccountingaccountfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra; $objp->code_sell_p = $objp->code_sell_intra;

View File

@ -499,7 +499,7 @@ if ($result) {
$suggestedaccountingaccountfor = 'eecwithvat'; $suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ? $objp->aarowid_suggest = $objp->aarowid; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
$suggestedaccountingaccountfor = 'eecwithoutvatnumber'; $suggestedaccountingaccountfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra; $objp->code_sell_p = $objp->code_sell_intra;
@ -512,7 +512,7 @@ if ($result) {
} }
} }
if (! empty($objp->code_sell_p)) { if (!empty($objp->code_sell_p)) {
// Value was defined previously // Value was defined previously
} else { } else {
$code_sell_p_notset = 'color:orange'; $code_sell_p_notset = 'color:orange';
@ -567,12 +567,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
// Found accounts // Found accounts
print '<td style="'.$code_sell_p_notset.'">'; print '<td>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
$s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("NotDefined")); $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
@ -583,7 +583,7 @@ if ($result) {
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p)); $s .= (empty($objp->code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '</td>'; print '</td>';
@ -595,7 +595,7 @@ if ($result) {
/*var_dump($suggestedid); /*var_dump($suggestedid);
var_dump($objp->code_sell_p); var_dump($objp->code_sell_p);
var_dump($objp->code_sell_l);*/ var_dump($objp->code_sell_l);*/
if (empty($suggestedid) && empty($objp->code_sell_p) && ! empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) if (empty($suggestedid) && empty($objp->code_sell_p) && !empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
{ {
if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l])) if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l]))
{ {
@ -632,7 +632,7 @@ if ($result) {
print $db->error(); print $db->error();
} }
if ($db->type == 'mysqli') { if ($db->type == 'mysqli') {
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
} }
// Add code to auto check the box when we select an account // Add code to auto check the box when we select an account

View File

@ -88,12 +88,12 @@ if ($conf->accounting->enabled)
} }
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial);
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n"; print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n";print "<br>\n"; print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
print '<hr>'; print '<hr>';

View File

@ -31,37 +31,37 @@
* \brief Page with bank journal * \brief Page with bank journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT . '/loan/class/paymentloan.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","other","compta","banks","bills","donations","loan","accountancy","trips","salaries","hrm","members")); $langs->loadLangs(array("companies", "other", "compta", "banks", "bills", "donations", "loan", "accountancy", "trips", "salaries", "hrm", "members"));
// Multi journal // Multi journal
$id_journal = GETPOST('id_journal', 'int'); $id_journal = GETPOST('id_journal', 'int');
@ -95,13 +95,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current; $pastmonthyear = $year_current;
if ($pastmonth == 0) { if ($pastmonth == 0) {
$pastmonth = 12; $pastmonth = 12;
$pastmonthyear --; $pastmonthyear--;
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{ {
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
@ -112,26 +112,26 @@ $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_jour
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,"; $sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,"; $sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,";
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier"; $sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; $sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal; $sql .= " WHERE ba.fk_accountancy_journal=".$id_journal;
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy $sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'"; $sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
// Already in bookkeeping or not // Already in bookkeeping or not
if ($in_bookkeeping == 'already') if ($in_bookkeeping == 'already')
{ {
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )"; $sql .= " AND (b.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
} }
if ($in_bookkeeping == 'notyet') if ($in_bookkeeping == 'notyet')
{ {
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )"; $sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
} }
$sql .= " ORDER BY b.datev"; $sql .= " ORDER BY b.datev";
//print $sql; //print $sql;
@ -149,7 +149,7 @@ $paymentsalstatic = new PaymentSalary($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db); $paymentexpensereportstatic = new PaymentExpenseReport($db);
$paymentvariousstatic = new PaymentVarious($db); $paymentvariousstatic = new PaymentVarious($db);
$paymentloanstatic = new PaymentLoan($db); $paymentloanstatic = new PaymentLoan($db);
$accountLinestatic=new AccountLine($db); $accountLinestatic = new AccountLine($db);
$paymentsubscriptionstatic = new Subscription($db); $paymentsubscriptionstatic = new Subscription($db);
$tmppayment = new Paiement($db); $tmppayment = new Paiement($db);
@ -171,20 +171,20 @@ if ($result) {
//print $sql; //print $sql;
// Variables // Variables
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
$account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word $account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word $account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word $account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_subscription = (! empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word $account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word $account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
$tabcompany = array(); $tabcompany = array();
$tabuser = array(); $tabuser = array();
$tabpay = array (); $tabpay = array();
$tabbq = array (); $tabbq = array();
$tabtp = array (); $tabtp = array();
$tabtype = array (); $tabtype = array();
$tabmoreinfo = array(); $tabmoreinfo = array();
// Loop on each line into llx_bank table. For each line, we should get: // Loop on each line into llx_bank table. For each line, we should get:
@ -199,8 +199,8 @@ if ($result) {
$lineisapurchase = -1; $lineisapurchase = -1;
$lineisasale = -1; $lineisasale = -1;
// Old method to detect if it's a sale or purchase // Old method to detect if it's a sale or purchase
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1; if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 1;
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1; if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale = 1;
// Try a more reliable method to detect if record is a supplier payment or a customer payment // Try a more reliable method to detect if record is a supplier payment or a customer payment
if ($lineisapurchase < 0) if ($lineisapurchase < 0)
{ {
@ -221,9 +221,9 @@ if ($result) {
if ($lineisapurchase > 0) if ($lineisapurchase > 0)
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier); $compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
if ($lineisasale > 0) if ($lineisasale > 0)
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer); $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer);
$tabcompany[$obj->rowid] = array ( $tabcompany[$obj->rowid] = array(
'id' => $obj->socid, 'id' => $obj->socid,
'name' => $obj->name, 'name' => $obj->name,
'code_compta' => $compta_soc, 'code_compta' => $compta_soc,
@ -231,9 +231,9 @@ if ($result) {
); );
// Set accountancy code for user // Set accountancy code for user
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee); $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
$tabuser[$obj->rowid] = array ( $tabuser[$obj->rowid] = array(
'id' => $obj->userid, 'id' => $obj->userid,
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname), 'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
'lastname' => $obj->lastname, 'lastname' => $obj->lastname,
@ -244,8 +244,8 @@ if ($result) {
// Variable bookkeeping ($obj->rowid is Bank Id) // Variable bookkeeping ($obj->rowid is Bank Id)
$tabpay[$obj->rowid]["date"] = $obj->do; $tabpay[$obj->rowid]["date"] = $obj->do;
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ... $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later $tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid; $tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref; $tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account; $tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
@ -254,14 +254,14 @@ if ($result) {
} else { } else {
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
} }
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
//var_dump($i); //var_dump($i);
//var_dump($tabpay); //var_dump($tabpay);
//var_dump($tabcompany); //var_dump($tabcompany);
// By default // By default
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url. $tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
$tabtype[$obj->rowid] = 'unknown'; $tabtype[$obj->rowid] = 'unknown';
$tabmoreinfo[$obj->rowid] = array(); $tabmoreinfo[$obj->rowid] = array();
@ -287,18 +287,18 @@ if ($result) {
} }
if ($links[$key]['type'] == 'withdraw') { if ($links[$key]['type'] == 'withdraw') {
$tabmoreinfo[$obj->rowid]['withdraw']=1; $tabmoreinfo[$obj->rowid]['withdraw'] = 1;
} }
if ($links[$key]['type'] == 'payment') { if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id']; $paymentstatic->id = $links[$key]['url_id'];
$paymentstatic->ref = $links[$key]['url_id']; $paymentstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this $tabpay[$obj->rowid]["lib"] .= ' '.$paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
$tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id; $tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id;
} elseif ($links[$key]['type'] == 'payment_supplier') { } elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsupplierstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id; $tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id;
} elseif ($links[$key]['type'] == 'company') { } elseif ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id']; $societestatic->id = $links[$key]['url_id'];
@ -313,13 +313,13 @@ if ($result) {
$userstatic->firstname = $tabuser[$obj->rowid]['firstname']; $userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
$userstatic->lastname = $tabuser[$obj->rowid]['lastname']; $userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount; if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
} elseif ($links[$key]['type'] == 'sc') { } elseif ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id']; $chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution') if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution'; $reg[1] = 'SocialContribution';
@ -332,13 +332,13 @@ if ($result) {
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
$sqlmid = 'SELECT cchgsoc.accountancy_code'; $sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; $sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid) {
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
@ -348,14 +348,14 @@ if ($result) {
$paymentdonstatic->id = $links[$key]['url_id']; $paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->ref = $links[$key]['url_id']; $paymentdonstatic->ref = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id; $tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount; $tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
} elseif ($links[$key]['type'] == 'member') { } elseif ($links[$key]['type'] == 'member') {
$paymentsubscriptionstatic->id = $links[$key]['url_id']; $paymentsubscriptionstatic->id = $links[$key]['url_id'];
$paymentsubscriptionstatic->ref = $links[$key]['url_id']; $paymentsubscriptionstatic->ref = $links[$key]['url_id'];
$paymentsubscriptionstatic->label = $links[$key]['label']; $paymentsubscriptionstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsubscriptionstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id; $tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id); $paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount; $tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
@ -363,14 +363,14 @@ if ($result) {
$paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label']; $paymentvatstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id; $tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount; $tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_salary') { } elseif ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label']; $paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
} elseif ($links[$key]['type'] == 'payment_expensereport') { } elseif ($links[$key]['type'] == 'payment_expensereport') {
$paymentexpensereportstatic->id = $links[$key]['url_id']; $paymentexpensereportstatic->id = $links[$key]['url_id'];
@ -380,25 +380,25 @@ if ($result) {
$paymentvariousstatic->id = $links[$key]['url_id']; $paymentvariousstatic->id = $links[$key]['url_id'];
$paymentvariousstatic->ref = $links[$key]['url_id']; $paymentvariousstatic->ref = $links[$key]['url_id'];
$paymentvariousstatic->label = $links[$key]['label']; $paymentvariousstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvariousstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
$paymentvariousstatic->fetch($paymentvariousstatic->id); $paymentvariousstatic->fetch($paymentvariousstatic->id);
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word $account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
$account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word $account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various; $tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount; $tabtp[$obj->rowid][$account_subledger] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_loan') { } elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id']; $paymentloanstatic->ref = $links[$key]['url_id'];
$paymentloanstatic->fk_loan = $links[$key]['url_id']; $paymentloanstatic->fk_loan = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentloanstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount; //$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest'; $sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
$sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l'; $sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
$sqlmid.= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid; $sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid) {
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
@ -408,7 +408,7 @@ if ($result) {
} }
} elseif ($links[$key]['type'] == 'banktransfert') { } elseif ($links[$key]['type'] == 'banktransfert') {
$accountLinestatic->fetch($links[$key]['url_id']); $accountLinestatic->fetch($links[$key]['url_id']);
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- ' .$accountLinestatic ->getNomUrl(1); $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
$tabtp[$obj->rowid][$account_transfer] += $obj->amount; $tabtp[$obj->rowid][$account_transfer] += $obj->amount;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']); $bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2); $tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
@ -420,14 +420,14 @@ if ($result) {
// If no links were found to know the amount on thirdparty, we try to guess it. // If no links were found to know the amount on thirdparty, we try to guess it.
// This may happens on bank entries without the links lines to 'company'. // This may happens on bank entries without the links lines to 'company'.
if (empty($tabtp[$obj->rowid]) && ! empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record
{ {
foreach ($links as $key => $val) { foreach ($links as $key => $val) {
if ($links[$key]['type'] == 'payment') { if ($links[$key]['type'] == 'payment') {
// Get thirdparty // Get thirdparty
$tmppayment->fetch($links[$key]['url_id']); $tmppayment->fetch($links[$key]['url_id']);
$arrayofamounts = $tmppayment->getAmountsArray(); $arrayofamounts = $tmppayment->getAmountsArray();
foreach($arrayofamounts as $invoiceid => $amount) foreach ($arrayofamounts as $invoiceid => $amount)
{ {
$tmpinvoice->fetch($invoiceid); $tmpinvoice->fetch($invoiceid);
$tmpinvoice->fetch_thirdparty(); $tmpinvoice->fetch_thirdparty();
@ -478,7 +478,7 @@ var_dump($tabtp);
var_dump($tabtype);*/ var_dump($tabtype);*/
// Write bookkeeping // Write bookkeeping
if (! $error && $action == 'writebookkeeping') { if (!$error && $action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0; $error = 0;
@ -501,7 +501,7 @@ if (! $error && $action == 'writebookkeeping') {
var_dump($tabbq);exit;*/ var_dump($tabbq);exit;*/
// Bank // Bank
if (! $errorforline && is_array($tabbq[$key])) if (!$errorforline && is_array($tabbq[$key]))
{ {
// Line into bank account // Line into bank account
foreach ($tabbq[$key] as $k => $mt) foreach ($tabbq[$key] as $k => $mt)
@ -509,9 +509,9 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']); if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
@ -528,7 +528,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->credit = ($mt < 0 ? -$mt : 0);
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
@ -562,7 +562,7 @@ if (! $error && $action == 'writebookkeeping') {
} }
// Third party // Third party
if (! $errorforline) if (!$errorforline)
{ {
if (is_array($tabtp[$key])) if (is_array($tabtp[$key]))
{ {
@ -571,14 +571,14 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":""); if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert') if ($tabtype[$key] == 'banktransfert')
{ {
$reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
} }
else else
{ {
$reflabel.= dol_string_nohtmltag($val['soclib']); $reflabel .= dol_string_nohtmltag($val['soclib']);
} }
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -590,7 +590,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->label_operation = $reflabel; $bookkeeping->label_operation = $reflabel;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
@ -598,15 +598,15 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
$bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice } elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
$bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
@ -715,8 +715,8 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel.= dol_string_nohtmltag('WaitingAccount'); $reflabel .= dol_string_nohtmltag('WaitingAccount');
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
@ -726,7 +726,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
@ -767,7 +767,7 @@ if (! $error && $action == 'writebookkeeping') {
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors'); setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
} }
if (! $errorforline) if (!$errorforline)
{ {
$db->commit(); $db->commit();
} }
@ -776,11 +776,11 @@ if (! $error && $action == 'writebookkeeping') {
//print 'KO for line '.$key.' '.$error.'<br>'; //print 'KO for line '.$key.' '.$error.'<br>';
$db->rollback(); $db->rollback();
$MAXNBERRORS=5; $MAXNBERRORS = 5;
if ($error >= $MAXNBERRORS) if ($error >= $MAXNBERRORS)
{ {
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors'); setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
break; // Break in the foreach break; // Break in the foreach
} }
} }
} }
@ -802,15 +802,15 @@ if (! $error && $action == 'writebookkeeping') {
// Must reload data, so we make a redirect // Must reload data, so we make a redirect
if (count($tabpay) != $error) if (count($tabpay) != $error)
{ {
$param='id_journal='.$id_journal; $param = 'id_journal='.$id_journal;
$param.='&date_startday='.$date_startday; $param .= '&date_startday='.$date_startday;
$param.='&date_startmonth='.$date_startmonth; $param .= '&date_startmonth='.$date_startmonth;
$param.='&date_startyear='.$date_startyear; $param .= '&date_startyear='.$date_startyear;
$param.='&date_endday='.$date_endday; $param .= '&date_endday='.$date_endday;
$param.='&date_endmonth='.$date_endmonth; $param .= '&date_endmonth='.$date_endmonth;
$param.='&date_endyear='.$date_endyear; $param .= '&date_endyear='.$date_endyear;
$param.='&in_bookkeeping='.$in_bookkeeping; $param .= '&in_bookkeeping='.$in_bookkeeping;
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:'')); header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
exit; exit;
} }
} }
@ -823,20 +823,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$filename = 'journal'; $filename = 'journal';
$type_export = 'journal'; $type_export = 'journal';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
// CSV header line // CSV header line
print '"' . $langs->transnoentitiesnoconv("BankId").'"' . $sep; print '"'.$langs->transnoentitiesnoconv("BankId").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("Date").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("PaymentMode") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("PaymentMode").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("LedgerAccount") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("SubledgerAccount") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("Label"). '"' . $sep; print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("Journal") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep; print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
print "\n"; print "\n";
foreach ($tabpay as $key => $val) foreach ($tabpay as $key => $val)
@ -850,21 +850,21 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']); if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
print '"' . $key . '"' . $sep; print '"'.$key.'"'.$sep;
print '"' . $date . '"' . $sep; print '"'.$date.'"'.$sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"'.$val["type_payment"].'"'.$sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print " " . $sep; print " ".$sep;
print '"' . $reflabel . '"' . $sep; print '"'.$reflabel.'"'.$sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"' . $journal . '"' . $sep; print '"'.$journal.'"'.$sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep; print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n"; print "\n";
} }
} }
@ -875,37 +875,37 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":""); if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert') if ($tabtype[$key] == 'banktransfert')
{ {
$reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
} }
else else
{ {
$reflabel.= dol_string_nohtmltag($val['soclib']); $reflabel .= dol_string_nohtmltag($val['soclib']);
} }
print '"' . $key . '"' . $sep; print '"'.$key.'"'.$sep;
print '"' . $date . '"' . $sep; print '"'.$date.'"'.$sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"'.$val["type_payment"].'"'.$sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
if ($tabtype[$key] == 'payment_supplier') { if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
} elseif($tabtype[$key] == 'payment') { } elseif ($tabtype[$key] == 'payment') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep; print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
} elseif($tabtype[$key] == 'payment_expensereport') { } elseif ($tabtype[$key] == 'payment_expensereport') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep; print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} elseif($tabtype[$key] == 'payment_salary') { } elseif ($tabtype[$key] == 'payment_salary') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep; print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} else { } else {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
} }
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"' . $reflabel . '"' . $sep; print '"'.$reflabel.'"'.$sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"' . $journal . '"' . $sep; print '"'.$journal.'"'.$sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep; print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n"; print "\n";
} }
} }
@ -914,20 +914,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel.= dol_string_nohtmltag('WaitingAccount'); $reflabel .= dol_string_nohtmltag('WaitingAccount');
print '"' . $key . '"' . $sep; print '"'.$key.'"'.$sep;
print '"' . $date . '"' . $sep; print '"'.$date.'"'.$sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"'.$val["type_payment"].'"'.$sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print "" . $sep; print "".$sep;
print '"' . $reflabel . '"' . $sep; print '"'.$reflabel.'"'.$sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"' . $journal . '"' . $sep; print '"'.$journal.'"'.$sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep; print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n"; print "\n";
} }
} }
@ -954,16 +954,16 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("FinanceJournal")); llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$builddate=dol_now(); $builddate = dol_now();
//$description = $langs->trans("DescFinanceJournal") . '<br>'; //$description = $langs->trans("DescFinanceJournal") . '<br>';
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
$period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal=' . $id_journal; $varlink = 'id_journal='.$id_journal;
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
@ -994,15 +994,15 @@ if (empty($action) || $action == 'view') {
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }
else { else {
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>'; else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
} }
print '</div>'; print '</div>';
@ -1033,14 +1033,14 @@ if (empty($action) || $action == 'view') {
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td>" . $langs->trans("Date") . "</td>"; print "<td>".$langs->trans("Date")."</td>";
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>"; print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>";
print "<td>" . $langs->trans("AccountAccounting") . "</td>"; print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>" . $langs->trans("SubledgerAccount") . "</td>"; print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>" . $langs->trans("LabelOperation") . "</td>"; print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">' . $langs->trans("PaymentMode") . "</td>"; print '<td class="center">'.$langs->trans("PaymentMode")."</td>";
print '<td class="right">' . $langs->trans("Debit") . "</td>"; print '<td class="right">'.$langs->trans("Debit")."</td>";
print '<td class="right">' . $langs->trans("Credit") . "</td>"; print '<td class="right">'.$langs->trans("Credit")."</td>";
print "</tr>\n"; print "</tr>\n";
$r = ''; $r = '';
@ -1057,15 +1057,15 @@ if (empty($action) || $action == 'view') {
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - "; if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
$reflabel.= $langs->trans("Bank").' '.$val['bank_account_ref']; $reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) $reflabel .= " - " . $val['soclib']; if (!empty($val['soclib'])) $reflabel .= " - ".$val['soclib'];
//var_dump($tabpay[$key]); //var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->'; print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $ref . "</td>"; print "<td>".$ref."</td>";
// Ledger account // Ledger account
print "<td>"; print "<td>";
$accounttoshow = length_accountg($k); $accounttoshow = length_accountg($k);
@ -1087,9 +1087,9 @@ if (empty($action) || $action == 'view') {
print "<td>"; print "<td>";
print $reflabel; print $reflabel;
print "</td>"; print "</td>";
print '<td class="center">' . $val["type_payment"] . "</td>"; print '<td class="center">'.$val["type_payment"]."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }
} }
@ -1100,20 +1100,20 @@ if (empty($action) || $action == 'view') {
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":""); if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert') if ($tabtype[$key] == 'banktransfert')
{ {
$reflabel.= $langs->trans('TransitionalAccount').' '.$account_transfer; $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
} }
else else
{ {
$reflabel.= $val['soclib']; $reflabel .= $val['soclib'];
} }
print '<!-- Thirdparty bank.rowid='.$key.' -->'; print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $ref . "</td>"; print "<td>".$ref."</td>";
// Ledger account // Ledger account
print "<td>"; print "<td>";
$account_ledger = $k; $account_ledger = $k;
@ -1137,19 +1137,19 @@ if (empty($action) || $action == 'view') {
} }
else else
{ {
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
} }
} }
else else
{ {
// We will refuse writing // We will refuse writing
$errorstring='UnknownAccountForThirdpartyBlocking'; $errorstring = 'UnknownAccountForThirdpartyBlocking';
if ($tabtype[$key] == 'payment') $errorstring='MainAccountForCustomersNotDefined'; if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined';
if ($tabtype[$key] == 'payment_supplier') $errorstring='MainAccountForSuppliersNotDefined'; if ($tabtype[$key] == 'payment_supplier') $errorstring = 'MainAccountForSuppliersNotDefined';
if ($tabtype[$key] == 'payment_expensereport') $errorstring='MainAccountForUsersNotDefined'; if ($tabtype[$key] == 'payment_expensereport') $errorstring = 'MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_salary') $errorstring='MainAccountForUsersNotDefined'; if ($tabtype[$key] == 'payment_salary') $errorstring = 'MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_vat') $errorstring='MainAccountForVatPaymentNotDefined'; if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined';
if ($tabtype[$key] == 'member') $errorstring='MainAccountForSubscriptionPaymentNotDefined'; if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
print '<span class="error">'.$langs->trans($errorstring).'</span>'; print '<span class="error">'.$langs->trans($errorstring).'</span>';
} }
} }
@ -1169,7 +1169,7 @@ if (empty($action) || $action == 'view') {
var_dump($tabtype[$key]); var_dump($tabtype[$key]);
var_dump($tabbq[$key]);*/ var_dump($tabbq[$key]);*/
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; //print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
if (! empty($tabcompany[$key]['code_compta'])) if (!empty($tabcompany[$key]['code_compta']))
{ {
if (in_array($tabtype[$key], array('payment_various'))) { if (in_array($tabtype[$key], array('payment_various'))) {
// For such case, if subledger is not defined, we won't use subledger accounts. // For such case, if subledger is not defined, we won't use subledger accounts.
@ -1187,10 +1187,10 @@ if (empty($action) || $action == 'view') {
} }
} }
print "</td>"; print "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>".$reflabel."</td>";
print '<td class="center">' . $val["type_payment"] . "</td>"; print '<td class="center">'.$val["type_payment"]."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }
} }
@ -1199,13 +1199,13 @@ if (empty($action) || $action == 'view') {
if ($mt) if ($mt)
{ {
$reflabel = ''; $reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - "; if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
$reflabel.= 'WaitingAccount'; $reflabel .= 'WaitingAccount';
print '<!-- Wait bank.rowid='.$key.' -->'; print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $ref . "</td>"; print "<td>".$ref."</td>";
// Ledger account // Ledger account
print "<td>"; print "<td>";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined') /*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
@ -1223,10 +1223,10 @@ if (empty($action) || $action == 'view') {
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE); else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/ */
print "</td>"; print "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>".$reflabel."</td>";
print '<td class="center">' . $val["type_payment"] . "</td>"; print '<td class="center">'.$val["type_payment"]."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }
} }
@ -1287,63 +1287,63 @@ function getSourceDocRef($val, $typerecord)
{ {
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref'; $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"]; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
$ref = $langs->transnoentitiesnoconv("Invoice"); $ref = $langs->transnoentitiesnoconv("Invoice");
} }
elseif ($typerecord == 'payment_supplier') elseif ($typerecord == 'payment_supplier')
{ {
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"]; $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
$ref = $langs->transnoentitiesnoconv("SupplierInvoice"); $ref = $langs->transnoentitiesnoconv("SupplierInvoice");
} }
elseif ($typerecord == 'payment_expensereport') elseif ($typerecord == 'payment_expensereport')
{ {
$sqlmid = 'SELECT e.rowid as id, e.ref'; $sqlmid = 'SELECT e.rowid as id, e.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid"; $sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
$ref = $langs->transnoentitiesnoconv("ExpenseReport"); $ref = $langs->transnoentitiesnoconv("ExpenseReport");
} }
elseif ($typerecord == 'payment_salary') elseif ($typerecord == 'payment_salary')
{ {
$sqlmid = 'SELECT s.rowid as ref'; $sqlmid = 'SELECT s.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"]; $sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
$ref = $langs->transnoentitiesnoconv("SalaryPayment"); $ref = $langs->transnoentitiesnoconv("SalaryPayment");
} }
elseif ($typerecord == 'sc') elseif ($typerecord == 'sc')
{ {
$sqlmid = 'SELECT sc.rowid as ref'; $sqlmid = 'SELECT sc.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
$sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"]; $sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
$ref = $langs->transnoentitiesnoconv("SocialContribution"); $ref = $langs->transnoentitiesnoconv("SocialContribution");
} }
elseif ($typerecord == 'payment_vat') elseif ($typerecord == 'payment_vat')
{ {
$sqlmid = 'SELECT v.rowid as ref'; $sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"]; $sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
$ref = $langs->transnoentitiesnoconv("PaymentVat"); $ref = $langs->transnoentitiesnoconv("PaymentVat");
} }
elseif ($typerecord == 'payment_donation') elseif ($typerecord == 'payment_donation')
{ {
$sqlmid = 'SELECT payd.fk_donation as ref'; $sqlmid = 'SELECT payd.fk_donation as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"]; $sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
$ref = $langs->transnoentitiesnoconv("Donation"); $ref = $langs->transnoentitiesnoconv("Donation");
} }
elseif ($typerecord == 'payment_loan') elseif ($typerecord == 'payment_loan')
{ {
$sqlmid = 'SELECT l.rowid as ref'; $sqlmid = 'SELECT l.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_loan as l"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
$sqlmid .= " WHERE l.rowid=" . $val["paymentloanid"]; $sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
$ref = $langs->transnoentitiesnoconv("LoanPayment"); $ref = $langs->transnoentitiesnoconv("LoanPayment");
} }
elseif ($typerecord == 'payment_various') elseif ($typerecord == 'payment_various')
{ {
$sqlmid = 'SELECT v.rowid as ref'; $sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"]; $sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
$ref = $langs->transnoentitiesnoconv("VariousPayment"); $ref = $langs->transnoentitiesnoconv("VariousPayment");
} }
// Add warning // Add warning
@ -1354,18 +1354,18 @@ function getSourceDocRef($val, $typerecord)
if ($sqlmid) if ($sqlmid)
{ {
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) if ($resultmid)
{ {
while ($objmid = $db->fetch_object($resultmid)) while ($objmid = $db->fetch_object($resultmid))
{ {
$ref.=' '.$objmid->ref; $ref .= ' '.$objmid->ref;
} }
} }
else dol_print_error($db); else dol_print_error($db);
} }
$ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300 $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
return $ref; return $ref;
} }

View File

@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true); $accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; $bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %';
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -448,36 +448,36 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"'.$date.'"'.$sep;
print '"' . $val["ref"] . '"' . $sep; print '"'.$val["ref"].'"'.$sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n"; print "\n";
} }
} }
// VAT // VAT
foreach ($tabtva[$key] as $k => $mt) { foreach ($tabtva[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"'.$date.'"'.$sep;
print '"' . $val["ref"] . '"' . $sep; print '"'.$val["ref"].'"'.$sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n"; print "\n";
} }
} }
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
print '"' . $date . '"' . $sep; print '"'.$date.'"'.$sep;
print '"' . $val["ref"] . '"' . $sep; print '"'.$val["ref"].'"'.$sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"' . dol_trunc($userstatic->name) . '"' . $sep; print '"'.dol_trunc($userstatic->name).'"'.$sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"'.($mt >= 0 ? price($mt) : '').'"';
} }
print "\n"; print "\n";
} }
@ -508,7 +508,7 @@ if (empty($action) || $action == 'view') {
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }
@ -641,8 +641,8 @@ if (empty($action) || $action == 'view') {
if ($mt) { if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- VAT -->"; print "<!-- VAT -->";
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>"; print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
@ -655,10 +655,10 @@ if (empty($action) || $action == 'view') {
// Subledger account // Subledger account
print "<td>"; print "<td>";
print '</td>'; print '</td>';
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:''); print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
print "</td>"; print "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }
} }

View File

@ -301,7 +301,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
@ -310,7 +310,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
@ -329,14 +329,14 @@ if ($action == 'writebookkeeping') {
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='other'; $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
@ -344,7 +344,7 @@ if ($action == 'writebookkeeping') {
} }
// Product / Service // Product / Service
if (! $errorforline) if (!$errorforline)
{ {
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
// get compte id and label // get compte id and label
@ -356,13 +356,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -381,14 +381,14 @@ if ($action == 'writebookkeeping') {
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='other'; $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
@ -398,10 +398,10 @@ if ($action == 'writebookkeeping') {
// VAT // VAT
// var_dump($tabtva); // var_dump($tabtva);
if (! $errorforline) if (!$errorforline)
{ {
$listoftax=array(0, 1, 2); $listoftax = array(0, 1, 2);
foreach($listoftax as $numtax) foreach ($listoftax as $numtax)
{ {
$arrayofvat = $tabtva; $arrayofvat = $tabtva;
if ($numtax == 1) $arrayofvat = $tablocaltax1; if ($numtax == 1) $arrayofvat = $tablocaltax1;
@ -416,7 +416,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
@ -425,7 +425,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true); $accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:''); $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -444,14 +444,14 @@ if ($action == 'writebookkeeping') {
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='other'; $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
@ -462,7 +462,7 @@ if ($action == 'writebookkeeping') {
// Counterpart of VAT for VAT NPR // Counterpart of VAT for VAT NPR
// var_dump($tabother); // var_dump($tabother);
if (! $errorforline && is_array($tabother[$key])) if (!$errorforline && is_array($tabother[$key]))
{ {
foreach ($tabother[$key] as $k => $mt) { foreach ($tabother[$key] as $k => $mt) {
if ($mt) { if ($mt) {
@ -478,7 +478,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' NPR'; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' NPR';
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -513,7 +513,7 @@ if ($action == 'writebookkeeping') {
} }
// Protection against a bug on lines before // Protection against a bug on lines before
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{ {
$error++; $error++;
$errorforline++; $errorforline++;
@ -740,7 +740,7 @@ if (empty($action) || $action == 'view') {
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }
@ -863,8 +863,8 @@ if (empty($action) || $action == 'view') {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Thirdparty -->"; print "<!-- Thirdparty -->";
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
@ -883,9 +883,9 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print '</td>'; print '</td>';
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; print "<td>".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount")."</td>";
print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }
@ -896,8 +896,8 @@ if (empty($action) || $action == 'view') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Product -->"; print "<!-- Product -->";
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
@ -912,9 +912,9 @@ if (empty($action) || $action == 'view') {
print '</td>'; print '</td>';
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>"; print "<td>".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }

View File

@ -99,31 +99,31 @@ $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_r
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " WHERE fd.fk_code_ventilation > 0"; $sql .= " WHERE fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing $sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
$sql .= " AND f.fk_statut > 0"; $sql .= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
} else { } else {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
} }
$sql .= " AND fd.product_type IN (0,1)"; $sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
// Already in bookkeeping or not // Already in bookkeeping or not
if ($in_bookkeeping == 'already') if ($in_bookkeeping == 'already')
{ {
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; $sql .= " AND f.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account // $sql .= " AND fd.rowid IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
} }
if ($in_bookkeeping == 'notyet') if ($in_bookkeeping == 'notyet')
{ {
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account // $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
} }
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
@ -312,7 +312,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount"); $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@ -340,14 +340,14 @@ if ($action == 'writebookkeeping') {
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else
{ {
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key]='other'; $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') {
} }
// Product / Service // Product / Service
if (! $errorforline) if (!$errorforline)
{ {
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
// get compte id and label // get compte id and label
@ -373,7 +373,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@ -408,10 +408,10 @@ if ($action == 'writebookkeeping') {
} }
// VAT // VAT
if (! $errorforline) if (!$errorforline)
{ {
$listoftax=array(0, 1, 2); $listoftax = array(0, 1, 2);
foreach($listoftax as $numtax) foreach ($listoftax as $numtax)
{ {
$arrayofvat = $tabtva; $arrayofvat = $tabtva;
if ($numtax == 1) $arrayofvat = $tablocaltax1; if ($numtax == 1) $arrayofvat = $tablocaltax1;
@ -426,7 +426,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
@ -435,7 +435,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true); $accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:''); $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@ -471,7 +471,7 @@ if ($action == 'writebookkeeping') {
} }
// Protection against a bug on lines before // Protection against a bug on lines before
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{ {
$error++; $error++;
$errorforline++; $errorforline++;
@ -677,7 +677,7 @@ if (empty($action) || $action == 'view') {
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} }
@ -799,8 +799,8 @@ if (empty($action) || $action == 'view') {
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Thirdparty -->"; print "<!-- Thirdparty -->";
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
@ -819,9 +819,9 @@ if (empty($action) || $action == 'view') {
} }
else print $accountoshow; else print $accountoshow;
print '</td>'; print '</td>';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount")."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }
@ -833,8 +833,8 @@ if (empty($action) || $action == 'view') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- Product -->"; print "<!-- Product -->";
print "<td>" . $date . "</td>"; print "<td>".$date."</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
@ -849,9 +849,9 @@ if (empty($action) || $action == 'view') {
print '</td>'; print '</td>';
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>"; print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label."</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
} }

View File

@ -373,7 +373,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
// Ref product // Ref product
print '<td>'; print '<td class="tdoverflowmax100">';
if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($product_static->id > 0) print $product_static->getNomUrl(1);
if ($product_static->id > 0 && $objp->product_label) print '<br>'; if ($product_static->id > 0 && $objp->product_label) print '<br>';
if ($objp->product_label) print $objp->product_label; if ($objp->product_label) print $objp->product_label;

View File

@ -462,7 +462,7 @@ if ($result) {
} }
} elseif ($objp->type_l == 0) { } elseif ($objp->type_l == 0) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = ''; $suggestedaccountingaccountbydefaultfor = '';
} else { } else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
@ -553,12 +553,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
// Found accounts // Found accounts
print '<td style="'.$code_buy_p_notset.'">'; print '<td>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
$s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("NotDefined")); $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
@ -567,7 +567,7 @@ if ($result) {
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_buy_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_buy_p)); $s .= (empty($objp->code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_buy_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '</td>'; print '</td>';

View File

@ -34,12 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","members")); $langs->loadLangs(array("admin", "members"));
if (! $user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$type=array('yesno','texte','chaine'); $type = array('yesno', 'texte', 'chaine');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
@ -52,19 +52,19 @@ $action = GETPOST('action', 'alpha');
if ($action == 'updateall') if ($action == 'updateall')
{ {
$db->begin(); $db->begin();
$res1=$res2=$res3=$res4=$res5=$res6=0; $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha')?0:1, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation // Use vat for invoice creation
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
$res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
{ {
$res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
} }
} }
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
@ -82,23 +82,23 @@ if ($action == 'updateall')
// Action to update or add a constant // Action to update or add a constant
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add')
{ {
$constname=GETPOST('constname', 'alpha'); $constname = GETPOST('constname', 'alpha');
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue=''; if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = '';
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{ {
if ($constvalue) $constvalue=0; if ($constvalue) $constvalue = 0;
else $constvalue=1; else $constvalue = 1;
} }
$consttype=GETPOST('consttype', 'alpha'); $consttype = GETPOST('consttype', 'alpha');
$constnote=GETPOST('constnote'); $constnote = GETPOST('constnote');
$res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
if (! $error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -111,7 +111,7 @@ if ($action == 'update' || $action == 'add')
// Action to enable of a submodule of the adherent module // Action to enable of a submodule of the adherent module
if ($action == 'set') if ($action == 'set')
{ {
$result=dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) if ($result < 0)
{ {
print $db->error(); print $db->error();
@ -121,7 +121,7 @@ if ($action == 'set')
// Action to disable a submodule of the adherent module // Action to disable a submodule of the adherent module
if ($action == 'unset') if ($action == 'unset')
{ {
$result=dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) if ($result < 0)
{ {
print $db->error(); print $db->error();
@ -136,12 +136,12 @@ if ($action == 'unset')
$form = new Form($db); $form = new Form($db);
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url); llxHeader('', $langs->trans("MembersSetup"), $help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@ -162,25 +162,25 @@ print "</tr>\n";
// Login/Pass required for members // Login/Pass required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1), 1); print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Mail required for members // Mail required for members
print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0), 1); print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Send mail information is on by default // Send mail information is on by default
print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0), 1); print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Insert subscription into bank account // Insert subscription into bank account
print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
$arraychoices=array('0'=>$langs->trans("None")); $arraychoices = array('0'=>$langs->trans("None"));
if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); if (!empty($conf->banque->enabled)) $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0); print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice')
@ -194,10 +194,10 @@ print "</tr>\n";
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
if (! empty($conf->banque->enabled)) if (!empty($conf->banque->enabled))
{ {
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
print '</td>'; print '</td>';
} }
else else
@ -208,7 +208,7 @@ if ($conf->facture->enabled)
} }
print "</tr>\n"; print "</tr>\n";
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
{ {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>'; print '<td>';
@ -232,7 +232,7 @@ print '<br>';
/* /*
* Edit info of model document * Edit info of model document
*/ */
$constantes=array( $constantes = array(
'ADHERENT_CARD_TYPE', 'ADHERENT_CARD_TYPE',
// 'ADHERENT_CARD_BACKGROUND', // 'ADHERENT_CARD_BACKGROUND',
'ADHERENT_CARD_HEADER_TEXT', 'ADHERENT_CARD_HEADER_TEXT',
@ -243,10 +243,10 @@ $constantes=array(
print load_fiche_titre($langs->trans("MembersCards"), '', ''); print load_fiche_titre($langs->trans("MembersCards"), '', '');
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__'; $helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext); form_constantes($constantes, 0, $helptext);
@ -256,14 +256,14 @@ print '<br>';
/* /*
* Edit info of model document * Edit info of model document
*/ */
$constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT'); $constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT');
print load_fiche_titre($langs->trans("MembersTickets"), '', ''); print load_fiche_titre($langs->trans("MembersTickets"), '', '');
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__'; $helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext); form_constantes($constantes, 0, $helptext);

View File

@ -34,25 +34,25 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","members")); $langs->loadLangs(array("admin", "members"));
if (! $user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$oldtypetonewone=array('texte'=>'text','chaine'=>'string'); // old type to new ones $oldtypetonewone = array('texte'=>'text', 'chaine'=>'string'); // old type to new ones
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$error = 0; $error = 0;
// Editing global variables not related to a specific theme // Editing global variables not related to a specific theme
$constantes=array( $constantes = array(
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))), 'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member', 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */ 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */ 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */ 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */ 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'ADHERENT_MAIL_FROM'=>'string', 'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string', 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html', 'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
@ -68,8 +68,8 @@ $constantes=array(
if ($action == 'updateall') if ($action == 'updateall')
{ {
$db->begin(); $db->begin();
$res1=$res2=$res3=$res4=$res5=$res6=0; $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1=dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
{ {
setEventMessages('ErrorFailedToSaveDate', null, 'errors'); setEventMessages('ErrorFailedToSaveDate', null, 'errors');
@ -86,19 +86,19 @@ if ($action == 'updateall')
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add')
{ {
$constlineid = GETPOST('rowid', 'int'); $constlineid = GETPOST('rowid', 'int');
$constname=GETPOST('constname', 'alpha'); $constname = GETPOST('constname', 'alpha');
$constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue')); $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
$consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype')); $consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
$constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote')); $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype]; $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
$res=dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
if (! $error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -111,7 +111,7 @@ if ($action == 'update' || $action == 'add')
// Action to enable a submodule of the adherent module // Action to enable a submodule of the adherent module
if ($action == 'set') if ($action == 'set')
{ {
$result=dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) if ($result < 0)
{ {
print $db->error(); print $db->error();
@ -121,7 +121,7 @@ if ($action == 'set')
// Action to disable a submodule of the adherent module // Action to disable a submodule of the adherent module
if ($action == 'unset') if ($action == 'unset')
{ {
$result=dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) if ($result < 0)
{ {
print $db->error(); print $db->error();
@ -136,12 +136,12 @@ if ($action == 'unset')
$form = new Form($db); $form = new Form($db);
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url); llxHeader('', $langs->trans("MembersSetup"), $help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@ -154,9 +154,9 @@ dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
//print '<input type="hidden" name="token" value="'.newToken().'">'; //print '<input type="hidden" name="token" value="'.newToken().'">';
//print '<input type="hidden" name="action" value="updateall">'; //print '<input type="hidden" name="action" value="updateall">';
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported //$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
form_constantes($constantes, 0, $helptext); form_constantes($constantes, 0, $helptext);

View File

@ -29,19 +29,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","members")); $langs->loadLangs(array("admin", "members"));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$form = new Form($db); $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label=ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label=array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype='adherent'; //Must be the $table_element of the class that manage extrafield $elementtype = 'adherent'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
@ -60,11 +60,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject = $langs->transnoentitiesnoconv("Members"); $textobject = $langs->transnoentitiesnoconv("Members");
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url); llxHeader('', $langs->trans("MembersSetup"), $help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@ -105,7 +105,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print '<div name="topofform"></div><br>'; print '<div name="topofform"></div><br>';
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -32,19 +32,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","members")); $langs->loadLangs(array("admin", "members"));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$form = new Form($db); $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label=ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label=array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype='adherent_type'; //Must be the $table_element of the class that manage extrafield $elementtype = 'adherent_type'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
@ -61,13 +61,13 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("MembersTypes"); $textobject = $langs->transnoentitiesnoconv("MembersTypes");
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url); llxHeader('', $langs->trans("MembersSetup"), $help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@ -108,7 +108,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -178,34 +178,34 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
$listofval = array(); $listofval = array();
$listofval += $adht->liste_array(); $listofval += $adht->liste_array();
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0); print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
print "</td></tr>\n"; print "</td></tr>\n";
// Amount // Amount
print '<tr class="oddeven" id="tramount"><td>'; print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("DefaultAmount"); print $langs->trans("DefaultAmount");
print '</td><td class="right">'; print '</td><td class="right">';
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">'; print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
print "</td></tr>\n"; print "</td></tr>\n";
// Can edit // Can edit
print '<tr class="oddeven" id="tredit"><td>'; print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("CanEditAmount"); print $langs->trans("CanEditAmount");
print '</td><td class="right">'; print '</td><td class="right">';
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0), 1); print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Jump to an online payment page // Jump to an online payment page
print '<tr class="oddeven" id="trpayment"><td>'; print '<tr class="oddeven" id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
print '</td><td class="right">'; print '</td><td class="right">';
$listofval=array(); $listofval = array();
$listofval['-1']=$langs->trans('No'); $listofval['-1'] = $langs->trans('No');
$listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox'; if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox';
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal'; if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal';
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe'; if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe';
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''), 0); print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
print "</td></tr>\n"; print "</td></tr>\n";
print '</table>'; print '</table>';

View File

@ -149,24 +149,24 @@ if ($object->id > 0)
$newcardbutton = ''; $newcardbutton = '';
if (! empty($conf->agenda->enabled)) if (!empty($conf->agenda->enabled))
{ {
$newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
} }
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
{ {
print '<br>'; print '<br>';
$param='&id='.$id; $param = '&id='.$id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1); print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
// List of all actions // List of all actions
$filters=array(); $filters = array();
$filters['search_agenda_label']=$search_agenda_label; $filters['search_agenda_label'] = $search_agenda_label;
// TODO Replace this with same code than into list.php // TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);

View File

@ -45,7 +45,7 @@ abstract class ActionsAdherentCardCommon
/** /**
* @var string Error code (or message) * @var string Error code (or message)
*/ */
public $error=''; public $error = '';
/** /**
* @var string[] Error codes (or messages) * @var string[] Error codes (or messages)
@ -70,7 +70,7 @@ abstract class ActionsAdherentCardCommon
else else
{*/ {*/
$object = new Adherent($this->db); $object = new Adherent($this->db);
if (! empty($id)) $object->fetch($id); if (!empty($id)) $object->fetch($id);
$this->object = $object; $this->object = $object;
//} //}
} }
@ -91,13 +91,13 @@ abstract class ActionsAdherentCardCommon
if ($action == 'add' || $action == 'update') $this->assign_post(); if ($action == 'add' || $action == 'update') $this->assign_post();
foreach($this->object as $key => $value) foreach ($this->object as $key => $value)
{ {
$this->tpl[$key] = $value; $this->tpl[$key] = $value;
} }
$this->tpl['error']=$this->error; $this->tpl['error'] = $this->error;
$this->tpl['errors']=$this->errors; $this->tpl['errors'] = $this->errors;
if ($action == 'create' || $action == 'edit') if ($action == 'create' || $action == 'edit')
{ {
@ -139,10 +139,10 @@ abstract class ActionsAdherentCardCommon
} }
// Zip // Zip
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town','selectcountry_id','state_id'), 6); $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
// Town // Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode','selectcountry_id','state_id')); $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id; if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
@ -157,14 +157,14 @@ abstract class ActionsAdherentCardCommon
else $this->tpl['select_state'] = $countrynotdefined; else $this->tpl['select_state'] = $countrynotdefined;
// Physical or Moral // Physical or Moral
$selectarray=array('0'=>$langs->trans("Physical"),'1'=>$langs->trans("Moral")); $selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0); $this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
} }
if ($action == 'view' || $action == 'edit' || $action == 'delete') if ($action == 'view' || $action == 'edit' || $action == 'delete')
{ {
// Emailing // Emailing
if (! empty($conf->mailing->enabled)) if (!empty($conf->mailing->enabled))
{ {
$langs->load("mails"); $langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
@ -173,8 +173,8 @@ abstract class ActionsAdherentCardCommon
// Dolibarr user // Dolibarr user
if ($this->object->user_id) if ($this->object->user_id)
{ {
$dolibarr_user=new User($this->db); $dolibarr_user = new User($this->db);
$result=$dolibarr_user->fetch($this->object->user_id); $result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
} }
else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
@ -200,14 +200,14 @@ abstract class ActionsAdherentCardCommon
$this->tpl['address'] = dol_nl2br($this->object->address); $this->tpl['address'] = dol_nl2br($this->object->address);
$this->tpl['zip'] = ($this->object->zip?$this->object->zip.'&nbsp;':''); $this->tpl['zip'] = ($this->object->zip ? $this->object->zip.'&nbsp;' : '');
$img=picto_from_langcode($this->object->country_code); $img = picto_from_langcode($this->object->country_code);
$this->tpl['country'] = ($img?$img.' ':'').$this->object->country; $this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country;
$this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
$this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
$this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
$this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy); $this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy);
@ -219,13 +219,13 @@ abstract class ActionsAdherentCardCommon
// Full firstname and lastname separated with a dot : firstname.lastname // Full firstname and lastname separated with a dot : firstname.lastname
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login=dol_buildlogin($this->object->lastname, $this->object->firstname); $login = dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password=getRandomPassword(false); $generated_password = getRandomPassword(false);
$password=$generated_password; $password = $generated_password;
// Create a form array // Create a form array
$formquestion=array( $formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password)); array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
@ -244,35 +244,35 @@ abstract class ActionsAdherentCardCommon
// phpcs:enable // phpcs:enable
global $langs, $mysoc; global $langs, $mysoc;
$this->object->old_name = $_POST["old_name"]; $this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"]; $this->object->old_firstname = $_POST["old_firstname"];
$this->object->fk_soc = $_POST["fk_soc"]; $this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"]; $this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"]; $this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"]; $this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"]; $this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"]; $this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
$this->object->state_id = $_POST["state_id"]; $this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"]; $this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"]; $this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"]; $this->object->email = $_POST["email"];
$this->object->note = $_POST["note"]; $this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"]; $this->object->canvas = $_POST["canvas"];
// We set country_id, and country_code label of the chosen country // We set country_id, and country_code label of the chosen country
if ($this->object->country_id) if ($this->object->country_id)
{ {
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id; $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$resql=$this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code; $this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
} }
else else
{ {

View File

@ -42,7 +42,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $db; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule; $this->targetmodule = $targetmodule;
$this->canvas = $canvas; $this->canvas = $canvas;
$this->card = $card; $this->card = $card;
@ -56,13 +56,13 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/ */
private function getTitle($action) private function getTitle($action)
{ {
global $langs,$conf; global $langs, $conf;
$out=''; $out = '';
if ($action == 'view') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress")); if ($action == 'view') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
if ($action == 'edit') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress")); if ($action == 'edit') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
if ($action == 'create') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress")); if ($action == 'create') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
return $out; return $out;
} }
@ -88,7 +88,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['title'] = $this->getTitle($action); $this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error; $this->tpl['error'] = $this->error;
$this->tpl['errors']= $this->errors; $this->tpl['errors'] = $this->errors;
if ($action == 'view') if ($action == 'view')
{ {
@ -96,15 +96,15 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$head = member_prepare_head($this->object); $head = member_prepare_head($this->object);
$title = $this->getTitle($action); $title = $this->getTitle($action);
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'adherent'); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
$this->tpl['showend']=dol_get_fiche_end(); $this->tpl['showend'] = dol_get_fiche_end();
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($this->object->socid); $objsoc->fetch($this->object->socid);
$this->tpl['actionstodo']=show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
$this->tpl['actionsdone']=show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} }
else else
{ {

View File

@ -17,7 +17,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) if (empty($conf) || !is_object($conf))
{ {
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
@ -30,9 +30,9 @@ if (empty($conf) || ! is_object($conf))
<?php <?php
print load_fiche_titre($this->control->tpl['title']); print load_fiche_titre($this->control->tpl['title']);
dol_htmloutput_errors((is_numeric($object->error)?'':$object->error), $object->errors); dol_htmloutput_errors((is_numeric($object->error) ? '' : $object->error), $object->errors);
dol_htmloutput_errors((is_numeric($GLOBALS['error'])?'':$GLOBALS['error']), $GLOBALS['errors']); dol_htmloutput_errors((is_numeric($GLOBALS['error']) ? '' : $GLOBALS['error']), $GLOBALS['errors']);
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);

View File

@ -17,7 +17,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) if (empty($conf) || !is_object($conf))
{ {
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
@ -48,7 +48,7 @@ echo $this->control->tpl['ajax_selectcountry'];
<input type="hidden" name="adherentid" value="<?php echo $this->control->tpl['id']; ?>"> <input type="hidden" name="adherentid" value="<?php echo $this->control->tpl['id']; ?>">
<input type="hidden" name="old_name" value="<?php echo $this->control->tpl['name']; ?>"> <input type="hidden" name="old_name" value="<?php echo $this->control->tpl['name']; ?>">
<input type="hidden" name="old_firstname" value="<?php echo $this->control->tpl['firstname']; ?>"> <input type="hidden" name="old_firstname" value="<?php echo $this->control->tpl['firstname']; ?>">
<?php if (! empty($this->control->tpl['company_id'])) { ?> <?php if (!empty($this->control->tpl['company_id'])) { ?>
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>"> <input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>">
<?php } ?> <?php } ?>

View File

@ -17,7 +17,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) if (empty($conf) || !is_object($conf))
{ {
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
@ -30,8 +30,8 @@ echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\n";
echo $this->control->tpl['showhead']; echo $this->control->tpl['showhead'];
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; if (!empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?> if (!empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<table class="border allwidth"> <table class="border allwidth">
@ -125,7 +125,7 @@ if (empty($user->socid)) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>'; echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
} }
if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>'; echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }

View File

@ -1773,8 +1773,10 @@ else
if ($action != 'editlogin' && $action != 'editthirdparty') if ($action != 'editlogin' && $action != 'editthirdparty')
{ {
// Send // Send
if ($object->statut == 1) { if (empty($user->socid)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>'; if ($object->statut == 1) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
}
} }
// Send card by email // Send card by email

View File

@ -29,22 +29,22 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
$langs->loadLangs(array("members","errors")); $langs->loadLangs(array("members", "errors"));
// Choice of printing year or current year. // Choice of printing year or current year.
$now = dol_now(); $now = dol_now();
$year=dol_print_date($now, '%Y'); $year = dol_print_date($now, '%Y');
$month=dol_print_date($now, '%m'); $month = dol_print_date($now, '%m');
$day=dol_print_date($now, '%d'); $day = dol_print_date($now, '%d');
$foruserid=GETPOST('foruserid', 'alphanohtml'); $foruserid = GETPOST('foruserid', 'alphanohtml');
$foruserlogin=GETPOST('foruserlogin', 'alphanohtml'); $foruserlogin = GETPOST('foruserlogin', 'alphanohtml');
$mode=GETPOST('mode', 'aZ09'); $mode = GETPOST('mode', 'aZ09');
$model=GETPOST("model", 'aZ09'); // Doc template to use for business cards $model = GETPOST("model", 'aZ09'); // Doc template to use for business cards
$modellabel=GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet $modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
$mesg=''; $mesg = '';
$adherentstatic=new Adherent($db); $adherentstatic = new Adherent($db);
$object=new Adherent($db); $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
@ -57,29 +57,29 @@ $extrafields->fetch_name_optionals_label($object->table_element);
if ($mode == 'cardlogin' && empty($foruserlogin)) if ($mode == 'cardlogin' && empty($foruserlogin))
{ {
$mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
} }
if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg) if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
{ {
$arrayofmembers=array(); $arrayofmembers = array();
// request taking into account member with up to date subscriptions // request taking into account member with up to date subscriptions
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,"; $sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,"; $sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql.= " t.libelle as type,"; $sql .= " t.libelle as type,";
$sql.= " c.code as country_code, c.label as country"; $sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields // Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) if (!empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1"; $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql.= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid; if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'"; if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql.= " ORDER BY d.rowid ASC"; $sql .= " ORDER BY d.rowid ASC";
dol_syslog("Search members", LOG_DEBUG); dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -91,19 +91,19 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
if ($objp->country == '-') $objp->country=''; if ($objp->country == '-') $objp->country = '';
$adherentstatic->id=$objp->rowid; $adherentstatic->id = $objp->rowid;
$adherentstatic->lastname=$objp->lastname; $adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname=$objp->firstname; $adherentstatic->firstname = $objp->firstname;
// Format extrafield so they can be parsed in function complete_substitutions_array // Format extrafield so they can be parsed in function complete_substitutions_array
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
{ {
$adherentstatic->array_options = array(); $adherentstatic->array_options = array();
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
$tmpkey='options_'.$key; $tmpkey = 'options_'.$key;
if (!empty($objp->$tmpkey)) if (!empty($objp->$tmpkey))
{ {
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey; $adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
@ -115,7 +115,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
} }
// List of values to scan for a replacement // List of values to scan for a replacement
$substitutionarray = array ( $substitutionarray = array(
'__ID__'=>$objp->rowid, '__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login, '__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname, '__FIRSTNAME__'=>$objp->firstname,
@ -139,21 +139,21 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
complete_substitutions_array($substitutionarray, $langs, $adherentstatic); complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// For business cards // For business cards
if (empty($mode) || $mode=='card' || $mode=='cardlogin') if (empty($mode) || $mode == 'card' || $mode == 'cardlogin')
{ {
$textleft=make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray); $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader=make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray); $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray); $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray); $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
if (is_numeric($foruserid) || $foruserlogin) if (is_numeric($foruserid) || $foruserlogin)
{ {
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; $nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb=1; // Protection to avoid empty page if ($nb <= 0) $nb = 1; // Protection to avoid empty page
for($j=0;$j<$nb;$j++) for ($j = 0; $j < $nb; $j++)
{ {
$arrayofmembers[]=array( $arrayofmembers[] = array(
'textleft'=>$textleft, 'textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
@ -165,7 +165,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
} }
else else
{ {
$arrayofmembers[]=array( $arrayofmembers[] = array(
'textleft'=>$textleft, 'textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
@ -179,13 +179,13 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// For labels // For labels
if ($mode == 'label') if ($mode == 'label')
{ {
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__"; if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
$textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray); $textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
$textheader=''; $textheader = '';
$textfooter=''; $textfooter = '';
$textright=''; $textright = '';
$arrayofmembers[]=array('textleft'=>$textleft, $arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
@ -197,29 +197,29 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
} }
// Build and output PDF // Build and output PDF
if (empty($mode) || $mode=='card' || $mode=='cardlogin') if (empty($mode) || $mode == 'card' || $mode == 'cardlogin')
{ {
if (! count($arrayofmembers)) if (!count($arrayofmembers))
{ {
$mesg=$langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($model) || $model == '-1') if (empty($model) || $model == '-1')
{ {
$mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
} }
if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs); if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} }
elseif ($mode == 'label') elseif ($mode == 'label')
{ {
if (! count($arrayofmembers)) if (!count($arrayofmembers))
{ {
$mesg=$langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($modellabel) || $modellabel == '-1') if (empty($modellabel) || $modellabel == '-1')
{ {
$mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
} }
if (! $mesg) $result=doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs); if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
} }
if ($result <= 0) if ($result <= 0)
@ -232,7 +232,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
dol_print_error($db); dol_print_error($db);
} }
if (! $mesg) if (!$mesg)
{ {
$db->close(); $db->close();
exit; exit;
@ -244,7 +244,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
* View * View
*/ */
$form=new Form($db); $form = new Form($db);
llxHeader('', $langs->trans("MembersCards")); llxHeader('', $langs->trans("MembersCards"));
@ -257,40 +257,40 @@ dol_htmloutput_errors($mesg);
print '<br>'; print '<br>';
print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="foruserid" value="all">'; print '<input type="hidden" name="foruserid" value="all">';
print '<input type="hidden" name="mode" value="card">'; print '<input type="hidden" name="mode" value="card">';
print '<input type="hidden" name="action" value="builddoc">'; print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_CARD_TYPE").' '; print $langs->trans("DescADHERENT_CARD_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array(); $arrayoflabels = array();
foreach(array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards)
{ {
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : $conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">'; print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br><br>'; print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="cardlogin">'; print '<input type="hidden" name="mode" value="cardlogin">';
print '<input type="hidden" name="action" value="builddoc">'; print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_CARD_TYPE").' '; print $langs->trans("DescADHERENT_CARD_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array(); $arrayoflabels = array();
foreach(array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards)
{ {
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : $conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">'; print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">'; print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
@ -299,18 +299,18 @@ print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="label">'; print '<input type="hidden" name="mode" value="label">';
print '<input type="hidden" name="action" value="builddoc">'; print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array(); $arrayoflabels = array();
foreach(array_keys($_Avery_Labels) as $codecards) foreach (array_keys($_Avery_Labels) as $codecards)
{ {
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ?GETPOST('modellabel') : $conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">'; print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';

View File

@ -60,6 +60,9 @@ class Adherent extends CommonObject
*/ */
public $ismultientitymanaged = 1; public $ismultientitymanaged = 1;
public $picto = 'member';
public $mesgs; public $mesgs;
/** /**
@ -273,7 +276,7 @@ class Adherent extends CommonObject
'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80), 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80),
'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 85), 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 85),
'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90),
'country' => array('type' => 'integer', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95), 'country' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95),
'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => -1, 'position' => 100), 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => -1, 'position' => 100),
'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 105), 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 105),
'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115), 'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115),
@ -657,7 +660,7 @@ class Adherent extends CommonObject
$action = 'update'; $action = 'update';
// Actions on extra fields // Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (!$error)
{ {
$result = $this->insertExtraFields(); $result = $this->insertExtraFields();
if ($result < 0) { if ($result < 0) {
@ -927,14 +930,11 @@ class Adherent extends CommonObject
// Removed extrafields // Removed extrafields
if (!$error) { if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used $result = $this->deleteExtraFields();
{ if ($result < 0) {
$result = $this->deleteExtraFields(); $error++;
if ($result < 0) { $errorflag = -4;
$error++; dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
} }
} }

View File

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

View File

@ -23,8 +23,8 @@
* \brief Fichier de la classe de gestion des stats des adhérents * \brief Fichier de la classe de gestion des stats des adhérents
*/ */
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
include_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
/** /**
@ -61,17 +61,17 @@ class AdherentStats extends Stats
$this->socid = $socid; $this->socid = $socid;
$this->userid = $userid; $this->userid = $userid;
$object=new Subscription($this->db); $object = new Subscription($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as p"; $this->from = MAIN_DB_PREFIX.$object->table_element." as p";
$this->from.= ", ".MAIN_DB_PREFIX."adherent as m"; $this->from .= ", ".MAIN_DB_PREFIX."adherent as m";
$this->field='subscription'; $this->field = 'subscription';
$this->where.= " m.statut != 0"; $this->where .= " m.statut != 0";
$this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")"; $this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if($this->memberid) if ($this->memberid)
{ {
$this->where .= " AND m.rowid = ".$this->memberid; $this->where .= " AND m.rowid = ".$this->memberid;
} }
@ -91,12 +91,12 @@ class AdherentStats extends Stats
global $user; global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
$sql.= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql .= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByMonth($year, $sql, $format); return $this->_getNbByMonth($year, $sql, $format);
} }
@ -111,11 +111,11 @@ class AdherentStats extends Stats
global $user; global $user;
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)"; $sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
$sql.= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where; $sql .= " WHERE ".$this->where;
$sql.= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByYear($sql); return $this->_getNbByYear($sql);
} }
@ -132,12 +132,12 @@ class AdherentStats extends Stats
global $user; global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
$sql.= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql .= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getAmountByMonth($year, $sql, $format); return $this->_getAmountByMonth($year, $sql, $format);
} }
@ -153,12 +153,12 @@ class AdherentStats extends Stats
global $user; global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
$sql.= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql .= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getAverageByMonth($year, $sql); return $this->_getAverageByMonth($year, $sql);
} }
@ -174,11 +174,11 @@ class AdherentStats extends Stats
global $user; global $user;
$sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql.= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where; $sql .= " WHERE ".$this->where;
$sql.= " GROUP BY year"; $sql .= " GROUP BY year";
$sql.= $this->db->order('year', 'DESC'); $sql .= $this->db->order('year', 'DESC');
return $this->_getAllByYear($sql); return $this->_getAllByYear($sql);
} }

View File

@ -59,17 +59,17 @@ class Members extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($id); $result = $member->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if( ! DolibarrApi::_checkAccessToResource('adherent', $member->id)) { if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -86,62 +86,71 @@ class Members extends DolibarrApi
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $typeid ID of the type of member * @param string $typeid ID of the type of member
* @param int $category Use this param to filter list by category
* @param string $sqlfilters Other criteria to filter answers separated by a comma. * @param string $sqlfilters Other criteria to filter answers separated by a comma.
* Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))" * Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
* @return array Array of member objects * @return array Array of member objects
* *
* @throws RestException * @throws RestException
*/ */
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $category = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$sql = "SELECT t.rowid"; $sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as t"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
$sql.= ' WHERE t.entity IN ('.getEntity('adherent').')'; if ($category > 0) {
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
}
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
if (!empty($typeid)) if (!empty($typeid))
{ {
$sql.= ' AND t.fk_adherent_type='.$typeid; $sql .= ' AND t.fk_adherent_type='.$typeid;
} }
// Select members of given category
if ($category > 0) {
$sql .= " AND c.fk_categorie = ".$db->escape($category);
$sql .= " AND c.fk_member = t.rowid ";
}
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters)
{ {
if (! DolibarrApi::_checkFilters($sqlfilters)) if (!DolibarrApi::_checkFilters($sqlfilters))
{ {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
$sql.= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) if ($page < 0)
{ {
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit)); $min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min) while ($i < $min)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$member = new Adherent($this->db); $member = new Adherent($this->db);
if($member->fetch($obj->rowid)) { if ($member->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($member); $obj_ret[] = $this->_cleanObjectDatas($member);
} }
$i++; $i++;
@ -150,7 +159,7 @@ class Members extends DolibarrApi
else { else {
throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror());
} }
if( ! count($obj_ret)) { if (!count($obj_ret)) {
throw new RestException(404, 'No member found'); throw new RestException(404, 'No member found');
} }
@ -165,14 +174,14 @@ class Members extends DolibarrApi
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
$result = $this->_validate($request_data); $result = $this->_validate($request_data);
$member = new Adherent($this->db); $member = new Adherent($this->db);
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
$member->$field = $value; $member->$field = $value;
} }
if ($member->create(DolibarrApiAccess::$user) < 0) { if ($member->create(DolibarrApiAccess::$user) < 0) {
@ -190,21 +199,21 @@ class Members extends DolibarrApi
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($id); $result = $member->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if( ! DolibarrApi::_checkAccessToResource('member', $member->id)) { if (!DolibarrApi::_checkAccessToResource('member', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
if ($field == 'id') continue; if ($field == 'id') continue;
// Process the status separately because it must be updated using // Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class Adherent. // the validate() and resiliate() methods of the class Adherent.
@ -245,20 +254,20 @@ class Members extends DolibarrApi
*/ */
public function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->supprimer) { if (!DolibarrApiAccess::$user->rights->adherent->supprimer) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($id); $result = $member->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if( ! DolibarrApi::_checkAccessToResource('member', $member->id)) { if (!DolibarrApi::_checkAccessToResource('member', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if (! $member->delete($member->id, DolibarrApiAccess::$user)) { if (!$member->delete($member->id, DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting member'); throw new RestException(401, 'error when deleting member');
} }
@ -334,13 +343,13 @@ class Members extends DolibarrApi
{ {
$obj_ret = array(); $obj_ret = array();
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($id); $result = $member->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
@ -365,13 +374,13 @@ class Members extends DolibarrApi
*/ */
public function createSubscription($id, $start_date, $end_date, $amount, $label = '') public function createSubscription($id, $start_date, $end_date, $amount, $label = '')
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($id); $result = $member->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
@ -393,7 +402,7 @@ class Members extends DolibarrApi
*/ */
public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{ {
if (! DolibarrApiAccess::$user->rights->categorie->lire) { if (!DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401); throw new RestException(401);
} }

View File

@ -55,17 +55,17 @@ class MembersTypes extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$membertype = new AdherentType($this->db); $membertype = new AdherentType($this->db);
$result = $membertype->fetch($id); $result = $membertype->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member type not found'); throw new RestException(404, 'member type not found');
} }
if( ! DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) { if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -92,40 +92,40 @@ class MembersTypes extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$sql = "SELECT t.rowid"; $sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= ' WHERE t.entity IN ('.getEntity('member_type').')'; $sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters)
{ {
if (! DolibarrApi::_checkFilters($sqlfilters)) if (!DolibarrApi::_checkFilters($sqlfilters))
{ {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
$sql.= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) if ($page < 0)
{ {
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit)); $min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min) while ($i < $min)
@ -141,7 +141,7 @@ class MembersTypes extends DolibarrApi
else { else {
throw new RestException(503, 'Error when retrieve member type list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve member type list : '.$db->lasterror());
} }
if ( ! count($obj_ret)) { if (!count($obj_ret)) {
throw new RestException(404, 'No member type found'); throw new RestException(404, 'No member type found');
} }
@ -156,14 +156,14 @@ class MembersTypes extends DolibarrApi
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
$result = $this->_validate($request_data); $result = $this->_validate($request_data);
$membertype = new AdherentType($this->db); $membertype = new AdherentType($this->db);
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
$membertype->$field = $value; $membertype->$field = $value;
} }
if ($membertype->create(DolibarrApiAccess::$user) < 0) { if ($membertype->create(DolibarrApiAccess::$user) < 0) {
@ -181,21 +181,21 @@ class MembersTypes extends DolibarrApi
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
} }
$membertype = new AdherentType($this->db); $membertype = new AdherentType($this->db);
$result = $membertype->fetch($id); $result = $membertype->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member type not found'); throw new RestException(404, 'member type not found');
} }
if( ! DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) { if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
if ($field == 'id') continue; if ($field == 'id') continue;
// Process the status separately because it must be updated using // Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class AdherentType. // the validate() and resiliate() methods of the class AdherentType.
@ -222,20 +222,20 @@ class MembersTypes extends DolibarrApi
*/ */
public function delete($id) public function delete($id)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
} }
$membertype = new AdherentType($this->db); $membertype = new AdherentType($this->db);
$result = $membertype->fetch($id); $result = $membertype->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'member type not found'); throw new RestException(404, 'member type not found');
} }
if ( ! DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) { if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if (! $membertype->delete()) { if (!$membertype->delete()) {
throw new RestException(401, 'error when deleting member type'); throw new RestException(401, 'error when deleting member type');
} }

View File

@ -58,13 +58,13 @@ class Subscriptions extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
$result = $subscription->fetch($id); $result = $subscription->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'Subscription not found'); throw new RestException(404, 'Subscription not found');
} }
@ -91,45 +91,45 @@ class Subscriptions extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
} }
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."subscription as t"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription as t";
$sql.= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters)
{ {
if (! DolibarrApi::_checkFilters($sqlfilters)) if (!DolibarrApi::_checkFilters($sqlfilters))
{ {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
$sql.= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) if ($page < 0)
{ {
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0; $i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < min($limit, $num)) while ($i < min($limit, $num))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
if($subscription->fetch($obj->rowid)) { if ($subscription->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($subscription); $obj_ret[] = $this->_cleanObjectDatas($subscription);
} }
$i++; $i++;
@ -138,7 +138,7 @@ class Subscriptions extends DolibarrApi
else { else {
throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror());
} }
if( ! count($obj_ret)) { if (!count($obj_ret)) {
throw new RestException(404, 'No Subscription found'); throw new RestException(404, 'No Subscription found');
} }
@ -153,14 +153,14 @@ class Subscriptions extends DolibarrApi
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
$result = $this->_validate($request_data); $result = $this->_validate($request_data);
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
$subscription->$field = $value; $subscription->$field = $value;
} }
if ($subscription->create(DolibarrApiAccess::$user) < 0) { if ($subscription->create(DolibarrApiAccess::$user) < 0) {
@ -178,17 +178,17 @@ class Subscriptions extends DolibarrApi
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
$result = $subscription->fetch($id); $result = $subscription->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'Subscription not found'); throw new RestException(404, 'Subscription not found');
} }
foreach($request_data as $field => $value) { foreach ($request_data as $field => $value) {
if ($field == 'id') continue; if ($field == 'id') continue;
$subscription->$field = $value; $subscription->$field = $value;
} }
@ -212,16 +212,16 @@ class Subscriptions extends DolibarrApi
public function delete($id) public function delete($id)
{ {
// The right to delete a subscription comes with the right to create one. // The right to delete a subscription comes with the right to create one.
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
$result = $subscription->fetch($id); $result = $subscription->fetch($id);
if( ! $result ) { if (!$result) {
throw new RestException(404, 'Subscription not found'); throw new RestException(404, 'Subscription not found');
} }
if (! $subscription->delete(DolibarrApiAccess::$user)) { if (!$subscription->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting subscription'); throw new RestException(401, 'error when deleting subscription');
} }

View File

@ -35,12 +35,12 @@ class Subscription extends CommonObject
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element='subscription'; public $element = 'subscription';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element='subscription'; public $table_element = 'subscription';
/** /**
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table
@ -50,7 +50,7 @@ class Subscription extends CommonObject
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto='payment'; public $picto = 'payment';
/** /**
* Date creation record (datec) * Date creation record (datec)
@ -93,7 +93,7 @@ class Subscription extends CommonObject
*/ */
public $fk_bank; public $fk_bank;
public $fields=array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
@ -133,12 +133,12 @@ class Subscription extends CommonObject
$error = 0; $error = 0;
$now=dol_now(); $now = dol_now();
// Check parameters // Check parameters
if ($this->datef <= $this->dateh) if ($this->datef <= $this->dateh)
{ {
$this->error=$langs->trans("ErrorBadValueForDate"); $this->error = $langs->trans("ErrorBadValueForDate");
return -1; return -1;
} }
if (empty($this->datec)) $this->datec = $now; if (empty($this->datec)) $this->datec = $now;
@ -149,37 +149,37 @@ class Subscription extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db); $member = new Adherent($this->db);
$result=$member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
if ($this->fk_type == null) { // If type not defined, we use the type of member if ($this->fk_type == null) { // If type not defined, we use the type of member
$type=$member->typeid; $type = $member->typeid;
} else { } else {
$type=$this->fk_type; $type = $this->fk_type;
} }
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',"; $sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',"; $sql .= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',"; $sql .= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.","; $sql .= " ".$this->amount.",";
$sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')"; $sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
} }
if (! $error) if (!$error)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_type = $type; $this->fk_type = $type;
} }
if (! $error && ! $notrigger) if (!$error && !$notrigger)
{ {
$this->context = array('member'=>$member); $this->context = array('member'=>$member);
// Call triggers // Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -203,16 +203,16 @@ class Subscription extends CommonObject
*/ */
public function fetch($rowid) public function fetch($rowid)
{ {
$sql ="SELECT rowid, fk_type, fk_adherent, datec,"; $sql = "SELECT rowid, fk_type, fk_adherent, datec,";
$sql.=" tms,"; $sql .= " tms,";
$sql.=" dateadh as dateh,"; $sql .= " dateadh as dateh,";
$sql.=" datef,"; $sql .= " datef,";
$sql.=" subscription, note, fk_bank"; $sql .= " subscription, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql.=" WHERE rowid=".$rowid; $sql .= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
@ -240,7 +240,7 @@ class Subscription extends CommonObject
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error = $this->db->lasterror();
return -1; return -1;
} }
} }
@ -275,14 +275,14 @@ class Subscription extends CommonObject
if ($resql) if ($resql)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db); $member = new Adherent($this->db);
$result=$member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
$result=$member->update_end_date($user); $result = $member->update_end_date($user);
if (! $error && ! $notrigger) { if (!$error && !$notrigger) {
$this->context = array('member'=>$member); $this->context = array('member'=>$member);
// Call triggers // Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
@ -290,7 +290,7 @@ class Subscription extends CommonObject
else else
{ {
$error++; $error++;
$this->error=$this->db->lasterror(); $this->error = $this->db->lasterror();
} }
// Commit or rollback // Commit or rollback
@ -318,39 +318,39 @@ class Subscription extends CommonObject
if ($this->fk_bank > 0) if ($this->fk_bank > 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db); $accountline = new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank); $result = $accountline->fetch($this->fk_bank);
} }
$this->db->begin(); $this->db->begin();
if (! $error) { if (!$error) {
if (! $notrigger) { if (!$notrigger) {
// Call triggers // Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} }
if (! $error) if (!$error)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num=$this->db->affected_rows($resql); $num = $this->db->affected_rows($resql);
if ($num) if ($num)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db); $member = new Adherent($this->db);
$result=$member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
$result=$member->update_end_date($user); $result = $member->update_end_date($user);
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined) if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{ {
$result=$accountline->delete($user); // Return false if refused because line is conciliated $result = $accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0) if ($result > 0)
{ {
$this->db->commit(); $this->db->commit();
@ -358,7 +358,7 @@ class Subscription extends CommonObject
} }
else else
{ {
$this->error=$accountline->error; $this->error = $accountline->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -378,7 +378,7 @@ class Subscription extends CommonObject
else else
{ {
$error++; $error++;
$this->error=$this->db->lasterror(); $this->error = $this->db->lasterror();
} }
} }
@ -407,29 +407,29 @@ class Subscription extends CommonObject
{ {
global $langs; global $langs;
$result=''; $result = '';
$langs->load("members"); $langs->load("members");
$label=$langs->trans("ShowSubscription").': '.$this->ref; $label = $langs->trans("ShowSubscription").': '.$this->ref;
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id; $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
if ($option != 'nolink') if ($option != 'nolink')
{ {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
} }
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">'; $linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>'; $linkend = '</a>';
$picto='payment'; $picto = 'payment';
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result.= $this->ref; if ($withpicto != 2) $result .= $this->ref;
$result .= $linkend; $result .= $linkend;
return $result; return $result;
@ -471,11 +471,11 @@ class Subscription extends CommonObject
public function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, c.datec,'; $sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem'; $sql .= ' c.tms as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c'; $sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql.= ' WHERE c.rowid = '.$id; $sql .= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))

View File

@ -34,45 +34,46 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members","other")); $langs->loadLangs(array("companies", "members", "other"));
$id=GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
// Security check // Security check
$result=restrictedArea($user, 'adherent', $id); $result = restrictedArea($user, 'adherent', $id);
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page ; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (!$sortorder) $sortorder = "ASC";
if (! $sortfield) $sortfield="name"; if (!$sortfield) $sortfield = "name";
$form = new Form($db); $form = new Form($db);
$object=new Adherent($db); $object = new Adherent($db);
$membert=new AdherentType($db); $membert = new AdherentType($db);
$result=$object->fetch($id); $result = $object->fetch($id);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member'); $upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
/* /*
* Actions * Actions
*/ */
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/* /*
@ -81,24 +82,24 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
$form = new Form($db); $form = new Form($db);
$title=$langs->trans("Member") . " - " . $langs->trans("Documents"); $title = $langs->trans("Member")." - ".$langs->trans("Documents");
$helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros"; $helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);
if ($id > 0) if ($id > 0)
{ {
$result=$membert->fetch($object->typeid); $result = $membert->fetch($object->typeid);
if ($result > 0) if ($result > 0)
{ {
// Build file list // Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize=0; $totalsize = 0;
foreach($filearray as $key => $file) foreach ($filearray as $key => $file)
{ {
$totalsize+=$file['size']; $totalsize += $file['size'];
} }
if (! empty($conf->notification->enabled)) if (!empty($conf->notification->enabled))
$langs->load("mails"); $langs->load("mails");
$head = member_prepare_head($object); $head = member_prepare_head($object);
@ -154,8 +155,8 @@ if ($id > 0)
$modulepart = 'member'; $modulepart = 'member';
$permission = $user->rights->adherent->creer; $permission = $user->rights->adherent->creer;
$permtoedit = $user->rights->adherent->creer; $permtoedit = $user->rights->adherent->creer;
$param = '&id=' . $object->id; $param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
print "<br><br>"; print "<br><br>";
} }
else else

View File

@ -27,7 +27,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
// Security check // Security check
if (! $user->rights->adherent->export) accessforbidden(); if (!$user->rights->adherent->export) accessforbidden();
/* /*
@ -36,30 +36,30 @@ if (! $user->rights->adherent->export) accessforbidden();
llxHeader(); llxHeader();
$now=dol_now(); $now = dol_now();
if (empty($sortorder)) { $sortorder="ASC"; } if (empty($sortorder)) { $sortorder = "ASC"; }
if (empty($sortfield)) { $sortfield="d.login"; } if (empty($sortfield)) { $sortfield = "d.login"; }
if (! isset($statut)) if (!isset($statut))
{ {
$statut = 1; $statut = 1;
} }
if (! isset($cotis)) if (!isset($cotis))
{ {
// by default, members must be up to date of subscription // by default, members must be up to date of subscription
$cotis=1; $cotis = 1;
} }
$sql = "SELECT d.login, d.pass, d.datefin"; $sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d "; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = ".$statut; $sql .= " WHERE d.statut = ".$statut;
if ($cotis==1) if ($cotis == 1)
{ {
$sql .= " AND datefin > '".$db->idate($now)."'"; $sql .= " AND datefin > '".$db->idate($now)."'";
} }
$sql.= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
//$sql.=$db->plimit($conf->liste_limit, $offset); //$sql.=$db->plimit($conf->liste_limit, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -74,7 +74,7 @@ if ($resql)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$htpass=crypt($objp->pass, makesalt()); $htpass = crypt($objp->pass, makesalt());
print $objp->login.":".$htpass."<br>\n"; print $objp->login.":".$htpass."<br>\n";
$i++; $i++;
} }

View File

@ -48,28 +48,28 @@ $result = restrictedArea($user, 'adherent');
llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'); llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$staticmember=new Adherent($db); $staticmember = new Adherent($db);
$statictype=new AdherentType($db); $statictype = new AdherentType($db);
$subscriptionstatic=new Subscription($db); $subscriptionstatic = new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"), '', 'members'); print load_fiche_titre($langs->trans("MembersArea"), '', 'members');
$Adherents=array(); $Adherents = array();
$AdherentsAValider=array(); $AdherentsAValider = array();
$MemberUpToDate=array(); $MemberUpToDate = array();
$AdherentsResilies=array(); $AdherentsResilies = array();
$AdherentType=array(); $AdherentType = array();
// Type of membership // Type of membership
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,"; $sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
$sql.= " d.statut, count(d.rowid) as somme"; $sql .= " d.statut, count(d.rowid) as somme";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
$sql.= " ON t.rowid = d.fk_adherent_type"; $sql .= " ON t.rowid = d.fk_adherent_type";
$sql.= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
$sql.= " WHERE t.entity IN (".getEntity('member_type').")"; $sql .= " WHERE t.entity IN (".getEntity('member_type').")";
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut"; $sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG); dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -81,32 +81,32 @@ if ($result)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$adhtype=new AdherentType($db); $adhtype = new AdherentType($db);
$adhtype->id=$objp->rowid; $adhtype->id = $objp->rowid;
$adhtype->subscription=$objp->subscription; $adhtype->subscription = $objp->subscription;
$adhtype->label=$objp->label; $adhtype->label = $objp->label;
$AdherentType[$objp->rowid]=$adhtype; $AdherentType[$objp->rowid] = $adhtype;
if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; } if ($objp->statut == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; }
if ($objp->statut == 1) { $MembersValidated[$objp->rowid]=$objp->somme; } if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; }
if ($objp->statut == 0) { $MembersResiliated[$objp->rowid]=$objp->somme; } if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; }
$i++; $i++;
} }
$db->free($result); $db->free($result);
} }
$now=dol_now(); $now = dol_now();
// Members up to date list // Members up to date list
// current rule: uptodate = the end date is in future whatever is type // current rule: uptodate = the end date is in future whatever is type
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future) // old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type"; $sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)"; $sql .= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
$sql.= " AND t.rowid = d.fk_adherent_type"; $sql .= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type"; $sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG); dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -191,10 +191,10 @@ if ($conf->use_javascript_ajax)
} }
$total = $SommeA + $SommeB + $SommeC + $SommeD; $total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries = array(); $dataseries = array();
$dataseries[] = array($langs->trans("MenuMembersNotUpToDate"), round($SommeB)); $dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[] = array($langs->trans("MenuMembersUpToDate"), round($SommeC)); $dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC));
$dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD)); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
$dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA)); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA));
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
@ -220,15 +220,15 @@ if ($conf->use_javascript_ajax)
print '<br>'; print '<br>';
// List of subscription by year // List of subscription by year
$Total=array(); $Total = array();
$Number=array(); $Number = array();
$tot=0; $tot = 0;
$numb=0; $numb = 0;
$sql = "SELECT c.subscription, c.dateadh as dateh"; $sql = "SELECT c.subscription, c.dateadh as dateh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " AND d.rowid = c.fk_adherent"; $sql .= " AND d.rowid = c.fk_adherent";
$result = $db->query($sql); $result = $db->query($sql);
@ -323,26 +323,26 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$staticmember->id=$obj->rowid; $staticmember->id = $obj->rowid;
$staticmember->lastname=$obj->lastname; $staticmember->lastname = $obj->lastname;
$staticmember->firstname=$obj->firstname; $staticmember->firstname = $obj->firstname;
if (! empty($obj->fk_soc)) if (!empty($obj->fk_soc))
{ {
$staticmember->fk_soc = $obj->fk_soc; $staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty(); $staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name; $staticmember->name = $staticmember->thirdparty->name;
} }
else else
{ {
$staticmember->name=$obj->company; $staticmember->name = $obj->company;
} }
$staticmember->ref=$staticmember->getFullName($langs); $staticmember->ref = $staticmember->getFullName($langs);
$statictype->id=$obj->typeid; $statictype->id = $obj->typeid;
$statictype->label=$obj->label; $statictype->label = $obj->label;
print '<td>'.$staticmember->getNomUrl(1, 32).'</td>'; print '<td>'.$staticmember->getNomUrl(1, 32).'</td>';
print '<td>'.$statictype->getNomUrl(1, 32).'</td>'; print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 3).'</td>'; print '<td class="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@ -30,21 +30,21 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members","ldap","admin")); $langs->loadLangs(array("companies", "members", "ldap", "admin"));
$rowid = GETPOST('id', 'int'); $rowid = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
// Protection // Protection
$socid=0; $socid = 0;
if ($user->socid > 0) if ($user->socid > 0)
{ {
$socid = $user->socid; $socid = $user->socid;
} }
$object = new Adherent($db); $object = new Adherent($db);
$result=$object->fetch($rowid); $result = $object->fetch($rowid);
if (! $result) if (!$result)
{ {
dol_print_error($db, "Failed to get adherent: ".$object->error); dol_print_error($db, "Failed to get adherent: ".$object->error);
exit; exit;
@ -57,16 +57,16 @@ if (! $result)
if ($action == 'dolibarr2ldap') if ($action == 'dolibarr2ldap')
{ {
$ldap=new Ldap(); $ldap = new Ldap();
$result=$ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0)
{ {
$info=$object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info); $dn = $object->_load_ldap_dn($info);
$olddn=$dn; // We can say that old dn = dn as we force synchro $olddn = $dn; // We can say that old dn = dn as we force synchro
$result=$ldap->update($dn, $info, $user, $olddn); $result = $ldap->update($dn, $info, $user, $olddn);
} }
if ($result >= 0) { if ($result >= 0) {
@ -104,7 +104,7 @@ print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
// If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else // If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
{ {
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>'; print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
print '<td class="valeur">'.$object->pass.'</td>'; print '<td class="valeur">'.$object->pass.'</td>';
@ -142,14 +142,14 @@ dol_fiche_end();
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr')
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
} }
print "</div>\n"; print "</div>\n";
if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') print "<br>\n"; if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') print "<br>\n";
@ -164,12 +164,12 @@ print '<td>'.$langs->trans("Value").'</td>';
print '</tr>'; print '</tr>';
// Lecture LDAP // Lecture LDAP
$ldap=new Ldap(); $ldap = new Ldap();
$result=$ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) if ($result > 0)
{ {
$info=$object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info, 1); $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
if (empty($dn)) if (empty($dn))
@ -184,15 +184,15 @@ if ($result > 0)
//print_r($records); //print_r($records);
// Show tree // Show tree
if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (!is_array($records))
{ {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} }
else else
{ {
$result=show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);
} }
} }
else else

View File

@ -106,6 +106,9 @@ $fieldstosearchall = array(
'd.address'=>'Address', 'd.address'=>'Address',
'd.zip'=>'Zip', 'd.zip'=>'Zip',
'd.town'=>'Town', 'd.town'=>'Town',
'd.phone'=>"Phone",
'd.phone_perso'=>"PhonePerso",
'd.phone_mobile'=>"PhoneMobile",
'd.note_public'=>'NotePublic', 'd.note_public'=>'NotePublic',
'd.note_private'=>'NotePrivate', 'd.note_private'=>'NotePrivate',
); );
@ -422,10 +425,9 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information"; $topicmail = "Information";
$modelmail = "member"; $modelmail = "member";
@ -947,8 +949,6 @@ print "</table>\n";
print "</div>"; print "</div>";
print '</form>'; print '</form>';
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 1);
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -29,23 +29,23 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members","bills")); $langs->loadLangs(array("companies", "members", "bills"));
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$id=GETPOST('id', 'int'); $id = GETPOST('id', 'int');
// Security check // Security check
$result=restrictedArea($user, 'adherent', $id); $result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db); $object = new Adherent($db);
$result=$object->fetch($id); $result = $object->fetch($id);
if ($result > 0) if ($result > 0)
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$result=$adht->fetch($object->typeid); $result = $adht->fetch($object->typeid);
} }
$permissionnote=$user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
/* /*
* Actions * Actions
@ -58,8 +58,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
/* /*
* View * View
*/ */
$title=$langs->trans("Member") . " - " . $langs->trans("Note"); $title = $langs->trans("Member")." - ".$langs->trans("Note");
$helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros"; $helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);
$form = new Form($db); $form = new Form($db);
@ -110,8 +110,8 @@ if ($id)
print '</div>'; print '</div>';
$cssclass='titlefield'; $cssclass = 'titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@ -29,7 +29,7 @@ $graphwidth = 700;
$mapratio = 0.5; $mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio); $graphheight = round($graphwidth * $mapratio);
$mode=GETPOST('mode')?GETPOST('mode'):''; $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check // Security check
@ -38,57 +38,57 @@ if ($user->socid > 0)
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
$result=restrictedArea($user, 'adherent', '', '', 'cotisation'); $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time()); $year = strftime("%Y", time());
$startyear=$year-2; $startyear = $year - 2;
$endyear=$year; $endyear = $year;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members")); $langs->loadLangs(array("companies", "members"));
/* /*
* View * View
*/ */
$memberstatic=new Adherent($db); $memberstatic = new Adherent($db);
llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, array('https://www.google.com/jsapi')); llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, array('https://www.google.com/jsapi'));
$title=$langs->trans("MembersStatisticsByProperties"); $title = $langs->trans("MembersStatisticsByProperties");
print load_fiche_titre($title, ''); print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir); dol_mkdir($dir);
$tab='byproperties'; $tab = 'byproperties';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code"; $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql .= " AND d.statut = 1";
$sql.=" GROUP BY d.morphy"; $sql .= " GROUP BY d.morphy";
$foundphy=$foundmor=0; $foundphy = $foundmor = 0;
// Define $data array // Define $data array
dol_syslog("Count member", LOG_DEBUG); dol_syslog("Count member", LOG_DEBUG);
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num=$db->num_rows($resql); $num = $db->num_rows($resql);
$i=0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj=$db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++; if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++; if ($obj->code == 'mor') $foundmor++;
$data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)); $data[] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
$i++; $i++;
} }
@ -106,14 +106,15 @@ dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'use
// Print title // Print title
if (! count($data)) if (!count($data))
{ {
print $langs->trans("NoValidatedMemberYet").'<br>'; print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>'; print '<br>';
} }
else else
{ {
print load_fiche_titre($langs->trans("MembersByNature"), '', ''); print $langs->trans("MembersByNature").'<br>';
print '<br>';
} }
// Print array // Print array
@ -125,8 +126,8 @@ print '<td class="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>'; print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>'; print '</tr>';
if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
foreach ($data as $val) foreach ($data as $val)
{ {

View File

@ -26,11 +26,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$graphwidth=DolGraph::getDefaultGraphSizeForStats('width', 700); $graphwidth = DolGraph::getDefaultGraphSizeForStats('width', 700);
$mapratio = 0.5; $mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio); $graphheight = round($graphwidth * $mapratio);
$mode=GETPOST('mode')?GETPOST('mode'):''; $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check // Security check
@ -39,32 +39,32 @@ if ($user->socid > 0)
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
$result=restrictedArea($user, 'adherent', '', '', 'cotisation'); $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time()); $year = strftime("%Y", time());
$startyear=$year-2; $startyear = $year - 2;
$endyear=$year; $endyear = $year;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members")); $langs->loadLangs(array("companies", "members"));
/* /*
* View * View
*/ */
$arrayjs=array('https://www.google.com/jsapi'); $arrayjs = array('https://www.google.com/jsapi');
if (! empty($conf->dol_use_jmobile)) $arrayjs=array(); if (!empty($conf->dol_use_jmobile)) $arrayjs = array();
$title=$langs->trans("Statistics"); $title = $langs->trans("Statistics");
if ($mode == 'memberbycountry') $title=$langs->trans("MembersStatisticsByCountries"); if ($mode == 'memberbycountry') $title = $langs->trans("MembersStatisticsByCountries");
if ($mode == 'memberbystate') $title=$langs->trans("MembersStatisticsByState"); if ($mode == 'memberbystate') $title = $langs->trans("MembersStatisticsByState");
if ($mode == 'memberbytown') $title=$langs->trans("MembersStatisticsByTown"); if ($mode == 'memberbytown') $title = $langs->trans("MembersStatisticsByTown");
if ($mode == 'memberbyregion') $title=$langs->trans("MembersStatisticsByRegion"); if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion");
llxHeader('', $title, '', '', 0, 0, $arrayjs); llxHeader('', $title, '', '', 0, 0, $arrayjs);
print load_fiche_titre($title, $mesg); print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir); dol_mkdir($dir);
@ -73,92 +73,92 @@ if ($mode)
// Define sql // Define sql
if ($mode == 'memberbycountry') if ($mode == 'memberbycountry')
{ {
$label=$langs->trans("Country"); $label = $langs->trans("Country");
$tab='statscountry'; $tab = 'statscountry';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label"; $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql .= " AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code"; $sql .= " GROUP BY c.label, c.code";
//print $sql; //print $sql;
} }
if ($mode == 'memberbystate') if ($mode == 'memberbystate')
{ {
$label=$langs->trans("Country"); $label = $langs->trans("Country");
$label2=$langs->trans("State"); $label2 = $langs->trans("State");
$tab='statsstate'; $tab = 'statsstate';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; // $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql .= " AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, c.nom"; $sql .= " GROUP BY co.label, co.code, c.nom";
//print $sql; //print $sql;
} }
if ($mode == 'memberbyregion') // if ($mode == 'memberbyregion') //
{ {
$label=$langs->trans("Country"); $label = $langs->trans("Country");
$label2=$langs->trans("Region"); //département $label2 = $langs->trans("Region"); //département
$tab='statsregion'; //onglet $tab = 'statsregion'; //onglet
$data = array(); //tableau de donnée $data = array(); //tableau de donnée
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2"; $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql .= " AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, r.nom"; //+ $sql .= " GROUP BY co.label, co.code, r.nom"; //+
//print $sql; //print $sql;
} }
if ($mode == 'memberbytown') if ($mode == 'memberbytown')
{ {
$label=$langs->trans("Country"); $label = $langs->trans("Country");
$label2=$langs->trans("Town"); $label2 = $langs->trans("Town");
$tab='statstown'; $tab = 'statstown';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2"; $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql .= " AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code, d.town"; $sql .= " GROUP BY c.label, c.code, d.town";
//print $sql; //print $sql;
} }
$langsen=new Translate('', $conf); $langsen = new Translate('', $conf);
$langsen->setDefaultLang('en_US'); $langsen->setDefaultLang('en_US');
$langsen->load("dict"); $langsen->load("dict");
//print $langsen->trans("Country"."FI");exit; //print $langsen->trans("Country"."FI");exit;
// Define $data array // Define $data array
dol_syslog("Count member", LOG_DEBUG); dol_syslog("Count member", LOG_DEBUG);
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num=$db->num_rows($resql); $num = $db->num_rows($resql);
$i=0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj=$db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($mode == 'memberbycountry') if ($mode == 'memberbycountry')
{ {
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'code'=>$obj->code, 'code'=>$obj->code,
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
@ -167,10 +167,10 @@ if ($mode)
} }
if ($mode == 'memberbyregion') //+ if ($mode == 'memberbyregion') //+
{ {
$data[]=array( $data[] = array(
'label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@ -178,9 +178,9 @@ if ($mode)
} }
if ($mode == 'memberbystate') if ($mode == 'memberbystate')
{ {
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@ -188,9 +188,9 @@ if ($mode)
} }
if ($mode == 'memberbytown') if ($mode == 'memberbytown')
{ {
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@ -214,7 +214,7 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title // Print title
if ($mode && ! count($data)) if ($mode && !count($data))
{ {
print $langs->trans("NoValidatedMemberYet").'<br>'; print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>'; print '<br>';
@ -224,7 +224,7 @@ else
if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'<br>'; if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'<br>';
elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'<br>'; elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'<br>';
elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'<br>'; elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'<br>';
elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'<br>';//+ elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'<br>'; //+
else else
{ {
print $langs->trans("MembersStatisticsDesc").'<br>'; print $langs->trans("MembersStatisticsDesc").'<br>';
@ -234,8 +234,8 @@ else
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>';
print '<br>'; print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>';//+ print '<br>'; //+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+ print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>'; //+
} }
print '<br>'; print '<br>';
} }
@ -260,16 +260,16 @@ if (count($arrayjs) && $mode == 'memberbycountry')
print "\tdata.addColumn('number', 'Number');\n"; print "\tdata.addColumn('number', 'Number');\n";
// loop and dump // loop and dump
$i=0; $i = 0;
foreach($data as $val) foreach ($data as $val)
{ {
$valcountry=strtoupper($val['code']); // Should be ISO-3166 code (faster) $valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']); //$valcountry=ucfirst($val['label_en']);
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels) if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n"; print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n";
print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n"; print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries // Google's Geomap only supports up to 400 entries
if ($i >= 400){ break; } if ($i >= 400) { break; }
$i++; $i++;
} }

View File

@ -28,11 +28,11 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0; $userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0; $socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0)
@ -40,28 +40,28 @@ if ($user->socid > 0)
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
$result=restrictedArea($user, 'adherent', '', '', 'cotisation'); $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time()); $year = strftime("%Y", time());
$startyear=$year-2; $startyear = $year - 2;
$endyear=$year; $endyear = $year;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members")); $langs->loadLangs(array("companies", "members"));
/* /*
* View * View
*/ */
$form=new Form($db); $form = new Form($db);
$title = $langs->trans("SubscriptionsStatistics"); $title = $langs->trans("SubscriptionsStatistics");
llxHeader('', $title); llxHeader('', $title);
print load_fiche_titre($title, '', 'members'); print load_fiche_titre($title, '', 'members');
$dir=$conf->adherent->dir_temp; $dir = $conf->adherent->dir_temp;
dol_mkdir($dir); dol_mkdir($dir);
@ -79,13 +79,13 @@ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscripti
$px1 = new DolGraph(); $px1 = new DolGraph();
$mesg = $px1->isGraphKo(); $mesg = $px1->isGraphKo();
if (! $mesg) if (!$mesg)
{ {
$px1->SetData($data); $px1->SetData($data);
$i=$startyear; $i = $startyear;
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[] = $i;
$i++; $i++;
} }
$px1->SetLegend($legend); $px1->SetLegend($legend);
@ -96,7 +96,7 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NbOfSubscriptions")); $px1->SetYLabel($langs->trans("NbOfSubscriptions"));
$px1->SetShading(3); $px1->SetShading(3);
$px1->SetHorizTickIncrement(1); $px1->SetHorizTickIncrement(1);
$px1->mode='depth'; $px1->mode = 'depth';
$px1->SetTitle($langs->trans("NbOfSubscriptions")); $px1->SetTitle($langs->trans("NbOfSubscriptions"));
$px1->draw($filenamenb, $fileurlnb); $px1->draw($filenamenb, $fileurlnb);
@ -112,13 +112,13 @@ $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscr
$px2 = new DolGraph(); $px2 = new DolGraph();
$mesg = $px2->isGraphKo(); $mesg = $px2->isGraphKo();
if (! $mesg) if (!$mesg)
{ {
$px2->SetData($data); $px2->SetData($data);
$i=$startyear; $i = $startyear;
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[] = $i;
$i++; $i++;
} }
$px2->SetLegend($legend); $px2->SetLegend($legend);
@ -129,7 +129,7 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfSubscriptions")); $px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
$px2->SetShading(3); $px2->SetShading(3);
$px2->SetHorizTickIncrement(1); $px2->SetHorizTickIncrement(1);
$px2->mode='depth'; $px2->mode = 'depth';
$px2->SetTitle($langs->trans("AmountOfSubscriptions")); $px2->SetTitle($langs->trans("AmountOfSubscriptions"));
$px2->draw($filenameamount, $fileurlamount); $px2->draw($filenameamount, $fileurlamount);
@ -174,11 +174,11 @@ print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
print '<td class="right">'.$langs->trans("AmountAverage").'</td>'; print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
print '</tr>'; print '</tr>';
$oldyear=0; $oldyear = 0;
foreach ($data as $val) foreach ($data as $val)
{ {
$year = $val['year']; $year = $val['year'];
while ($oldyear > $year+1) while ($oldyear > $year + 1)
{ // If we have empty year { // If we have empty year
$oldyear--; $oldyear--;
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
@ -202,7 +202,7 @@ foreach ($data as $val)
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>'; print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>'; print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year; $oldyear = $year;
} }
print '</table>'; print '</table>';

View File

@ -81,33 +81,33 @@ if ($rowid)
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
// Define variables to know what current user can do on users // Define variables to know what current user can do on users
$canadduser=($user->admin || $user->rights->user->user->creer); $canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member // Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) if ($object->user_id)
{ {
// $user is the user editing, $object->user_id is the user's id linked to the edited member // $user is the user editing, $object->user_id is the user's id linked to the edited member
$caneditfielduser=( (($user->id == $object->user_id) && $user->rights->user->self->creer) $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer) ); || (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser=( (($user->id == $object->user_id) && $user->rights->user->self->password) $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password) ); || (($user->id != $object->user_id) && $user->rights->user->user->password));
} }
} }
// Define variables to know what current user can do on members // Define variables to know what current user can do on members
$canaddmember=$user->rights->adherent->creer; $canaddmember = $user->rights->adherent->creer;
// Define variables to know what current user can do on properties of a member // Define variables to know what current user can do on properties of a member
if ($rowid) if ($rowid)
{ {
$caneditfieldmember=$user->rights->adherent->creer; $caneditfieldmember = $user->rights->adherent->creer;
} }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('subscription')); $hookmanager->initHooks(array('subscription'));
// PDF // PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
/* /*

View File

@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies","members","bills","users")); $langs->loadLangs(array("companies", "members", "bills", "users"));
if (!$user->rights->adherent->lire) if (!$user->rights->adherent->lire)
accessforbidden(); accessforbidden();
$rowid=GETPOST("rowid", 'int'); $rowid = GETPOST("rowid", 'int');

View File

@ -259,10 +259,9 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information"; $topicmail = "Information";
$modelmail = "subscription"; $modelmail = "subscription";

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net> * Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -239,6 +240,8 @@ if (!$rowid && $action != 'create' && $action != 'edit')
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
@ -252,10 +255,9 @@ if (!$rowid && $action != 'create' && $action != 'edit')
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
$moreforfilter = ''; $moreforfilter = '';
@ -375,13 +377,8 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters = array(); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
print $object->showOptionals($extrafields, 'edit', $parameters);
}
print '<tbody>'; print '<tbody>';
print "</table>\n"; print "</table>\n";
@ -822,15 +819,6 @@ if ($rowid > 0)
// Other attributes // Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
print $object->showOptionals($extrafields, 'edit', $parameters);
}
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@ -71,21 +71,21 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
// update of object // update of object
if ( $_POST["forcelangprod"] == $current_lang ) if ($_POST["forcelangprod"] == $current_lang)
{ {
$object->label = $_POST["libelle"]; $object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]); $object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]); $object->other = dol_htmlcleanlastbr($_POST["other"]);
} }
else else
{ {
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]); $object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]);
} }
// backup into database // backup into database
if ( $object->setMultiLangs($user) > 0 ) if ($object->setMultiLangs($user) > 0)
{ {
$action = ''; $action = '';
} }

View File

@ -28,27 +28,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$action=GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'companies')); $langs->loadLangs(array('admin', 'companies'));
if (! $user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$error=0; $error = 0;
/* /*
* Actions * Actions
*/ */
$parameters=array(); $parameters = array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|| ($action == 'updateedit') ) || ($action == 'updateedit'))
{ {
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'nohtml'), 'chaine', 0, '', $conf->entity);
@ -64,7 +64,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
if ($action != 'updateedit' && ! $error) if ($action != 'updateedit' && !$error)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
@ -75,7 +75,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
* View * View
*/ */
$help_url=''; $help_url = '';
llxHeader('', $langs->trans("CompanyFoundation"), $help_url); llxHeader('', $langs->trans("CompanyFoundation"), $help_url);
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup'); print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
@ -84,11 +84,11 @@ $head = company_admin_prepare_head();
dol_fiche_head($head, 'accountant', $langs->trans("Company"), -1, 'company'); dol_fiche_head($head, 'accountant', $langs->trans("Company"), -1, 'company');
$form=new Form($db); $form = new Form($db);
$formother=new FormOther($db); $formother = new FormOther($db);
$formcompany=new FormCompany($db); $formcompany = new FormCompany($db);
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>'; $countrynotdefined = '<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
@ -109,26 +109,26 @@ print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">'
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name // Name
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom", 'nohtml')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_NAME ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address // Address
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address", 'nohtml')) . '</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : GETPOST("address", 'nohtml')).'</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode", 'alpha')) . '"></td></tr>'."\n"; print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_ZIP ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : GETPOST("zipcode", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town", 'nohtml')) . '"></td></tr>'."\n"; print '<input name="town" class="minwidth100" id="town" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_TOWN ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : GETPOST("town", 'nohtml')).'"></td></tr>'."\n";
// Country // Country
print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
@ -139,28 +139,28 @@ print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>'; print '<input name="tel" id="phone" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_PHONE.'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>'; print '<input name="fax" id="fax" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_FAX.'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>'; print '<input name="mail" id="email" class="minwidth200" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_MAIL.'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Web // Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>'; print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>'; print '<input name="web" id="web" class="minwidth300" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_WEB.'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Code // Code
print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>'; print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code", 'nohtml')) . '"></td></tr>'."\n"; print '<input name="code" id="code" class="minwidth100" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_CODE ? $conf->global->MAIN_INFO_ACCOUNTANT_CODE : GETPOST("code", 'nohtml')).'"></td></tr>'."\n";
// Note // Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>'; print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';

View File

@ -172,7 +172,7 @@ if (!empty($triggers))
// If 'element' value is myobject@mymodule instead of mymodule // If 'element' value is myobject@mymodule instead of mymodule
$tmparray = explode('@', $module); $tmparray = explode('@', $module);
if (! empty($tmparray[1])) { if (!empty($tmparray[1])) {
$module = $tmparray[1]; $module = $tmparray[1];
} }

View File

@ -41,13 +41,13 @@ $extrafields = new ExtraFields($db);
$form = new Form($db); $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label=ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label=array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype='actioncomm'; //Must be the $table_element of the class that manage extrafield $elementtype = 'actioncomm'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
@ -64,15 +64,15 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Agenda"); $textobject = $langs->transnoentitiesnoconv("Agenda");
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; $wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp); llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
$head=agenda_prepare_head(); $head = agenda_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), -1, 'action'); dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), -1, 'action');
@ -109,7 +109,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -38,14 +38,14 @@ if (!$user->admin) accessforbidden();
$langs->loadLangs(array('agenda', 'admin', 'other')); $langs->loadLangs(array('agenda', 'admin', 'other'));
$def = array(); $def = array();
$actiontest=GETPOST('test', 'alpha'); $actiontest = GETPOST('test', 'alpha');
$actionsave=GETPOST('save', 'alpha'); $actionsave = GETPOST('save', 'alpha');
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB; $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
// List of available colors // List of available colors
$colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5'); $colorlist = array('BECEDD', 'DDBECE', 'BFDDBE', 'F598B4', 'F68654', 'CBF654', 'A4A4A5');
/* /*
@ -56,23 +56,23 @@ if ($actionsave)
{ {
$db->begin(); $db->begin();
$disableext=GETPOST('AGENDA_DISABLE_EXT', 'alpha'); $disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha');
$res=dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity);
$i=1; $errorsaved=0; $i = 1; $errorsaved = 0;
$error=0; $error = 0;
// Save agendas // Save agendas
while ($i <= $MAXAGENDA) while ($i <= $MAXAGENDA)
{ {
$name=trim(GETPOST('AGENDA_EXT_NAME'.$i, 'alpha')); $name = trim(GETPOST('AGENDA_EXT_NAME'.$i, 'alpha'));
$src=trim(GETPOST('AGENDA_EXT_SRC'.$i, 'alpha')); $src = trim(GETPOST('AGENDA_EXT_SRC'.$i, 'alpha'));
$offsettz=trim(GETPOST('AGENDA_EXT_OFFSETTZ'.$i, 'alpha')); $offsettz = trim(GETPOST('AGENDA_EXT_OFFSETTZ'.$i, 'alpha'));
$color=trim(GETPOST('AGENDA_EXT_COLOR'.$i, 'alpha')); $color = trim(GETPOST('AGENDA_EXT_COLOR'.$i, 'alpha'));
if ($color=='-1') $color=''; if ($color == '-1') $color = '';
$enabled=trim(GETPOST('AGENDA_EXT_ENABLED'.$i, 'alpha')); $enabled = trim(GETPOST('AGENDA_EXT_ENABLED'.$i, 'alpha'));
if (! empty($src) && ! dol_is_url($src)) if (!empty($src) && !dol_is_url($src))
{ {
setEventMessages($langs->trans("ErrorParamMustBeAnUrl"), null, 'errors'); setEventMessages($langs->trans("ErrorParamMustBeAnUrl"), null, 'errors');
$error++; $error++;
@ -81,29 +81,29 @@ if ($actionsave)
} }
//print '-name='.$name.'-color='.$color; //print '-name='.$name.'-color='.$color;
$res=dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
$i++; $i++;
} }
// Save nb of agenda // Save nb of agenda
if (! $error) if (!$error)
{ {
$res=dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOST('AGENDA_EXT_NB', 'int')), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOST('AGENDA_EXT_NB', 'int')), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; $MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB;
} }
if (! $error) if (!$error)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -119,24 +119,24 @@ if ($actionsave)
* View * View
*/ */
$form=new Form($db); $form = new Form($db);
$formadmin=new FormAdmin($db); $formadmin = new FormAdmin($db);
$formother=new FormOther($db); $formother = new FormOther($db);
$arrayofjs=array(); $arrayofjs = array();
$arrayofcss=array(); $arrayofcss = array();
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; $wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, $arrayofjs, $arrayofcss); llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, $arrayofjs, $arrayofcss);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="save">'; print '<input type="hidden" name="action" value="save">';
$head=agenda_prepare_head(); $head = agenda_prepare_head();
dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action'); dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action');
@ -144,8 +144,8 @@ print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span
print "<br>\n"; print "<br>\n";
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; $selectedvalue = $conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; if ($selectedvalue == 1) $selectedvalue = 0; else $selectedvalue = 1;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
@ -199,30 +199,30 @@ print "<td>".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFix
print '<td class="right">'.$langs->trans("Color").'</td>'; print '<td class="right">'.$langs->trans("Color").'</td>';
print "</tr>"; print "</tr>";
$i=1; $i = 1;
while ($i <= $MAXAGENDA) while ($i <= $MAXAGENDA)
{ {
$key=$i; $key = $i;
$name='AGENDA_EXT_NAME'.$key; $name = 'AGENDA_EXT_NAME'.$key;
$src='AGENDA_EXT_SRC'.$key; $src = 'AGENDA_EXT_SRC'.$key;
$offsettz='AGENDA_EXT_OFFSETTZ'.$key; $offsettz = 'AGENDA_EXT_OFFSETTZ'.$key;
$color='AGENDA_EXT_COLOR'.$key; $color = 'AGENDA_EXT_COLOR'.$key;
$enabled='AGENDA_EXT_ENABLED'.$key; $enabled = 'AGENDA_EXT_ENABLED'.$key;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Nb // Nb
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb", $key)."</td>"; print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb", $key)."</td>";
// Name // Name
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME'.$key.'" value="'. (GETPOST('AGENDA_EXT_NAME'.$key)?GETPOST('AGENDA_EXT_NAME'.$key, 'alpha'):$conf->global->$name) . '" size="28"></td>'; print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME'.$key.'" value="'.(GETPOST('AGENDA_EXT_NAME'.$key) ?GETPOST('AGENDA_EXT_NAME'.$key, 'alpha') : $conf->global->$name).'" size="28"></td>';
// URL // URL
print '<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC'.$key.'" value="'. (GETPOST('AGENDA_EXT_SRC'.$key)?GETPOST('AGENDA_EXT_SRC'.$key, 'alpha'):$conf->global->$src) . '" size="60"></td>'; print '<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC'.$key.'" value="'.(GETPOST('AGENDA_EXT_SRC'.$key) ?GETPOST('AGENDA_EXT_SRC'.$key, 'alpha') : $conf->global->$src).'" size="60"></td>';
// Offset TZ // Offset TZ
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ'.$key.'" value="'. (GETPOST('AGENDA_EXT_OFFSETTZ'.$key)?GETPOST('AGENDA_EXT_OFFSETTZ'.$key):$conf->global->$offsettz) . '" size="2"></td>'; print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ'.$key.'" value="'.(GETPOST('AGENDA_EXT_OFFSETTZ'.$key) ?GETPOST('AGENDA_EXT_OFFSETTZ'.$key) : $conf->global->$offsettz).'" size="2"></td>';
// Color (Possible colors are limited by Google) // Color (Possible colors are limited by Google)
print '<td class="nowrap right">'; print '<td class="nowrap right">';
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist); //print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key)?GETPOST("AGENDA_EXT_COLOR".$key):$conf->global->$color), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset'); print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : $conf->global->$color), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset');
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
$i++; $i++;

View File

@ -324,7 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
} }
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">'; print '<input type="hidden" name="action" value="set">';
print '<table class="noborder allwidth">'."\n"; print '<table class="noborder allwidth">'."\n";

View File

@ -30,7 +30,7 @@ if (!$user->admin)
accessforbidden(); accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","other","agenda")); $langs->loadLangs(array("admin", "other", "agenda"));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
@ -48,8 +48,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code=$reg[1]; $code = $reg[1];
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1); $value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
@ -63,7 +63,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code=$reg[1]; $code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
@ -83,21 +83,21 @@ if ($action == 'set')
} }
elseif ($action == 'specimen') // For orders elseif ($action == 'specimen') // For orders
{ {
$modele=GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
$commande->thirdparty=$specimenthirdparty; $commande->thirdparty = $specimenthirdparty;
// Search template files // Search template files
$file=''; $classname=''; $filefound=0; $file = ''; $classname = ''; $filefound = 0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound=1; $filefound = 1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break; break;
} }
@ -166,21 +166,21 @@ elseif ($action == 'setdoc')
* View * View
*/ */
$formactions=new FormActions($db); $formactions = new FormActions($db);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(); llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
$head=agenda_prepare_head(); $head = agenda_prepare_head();
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">'; print '<input type="hidden" name="action" value="set">';
print '<table class="noborder allwidth">'."\n"; print '<table class="noborder allwidth">'."\n";

View File

@ -89,17 +89,17 @@ elseif ($action == 'update')
elseif ($action == 'updateengine') elseif ($action == 'updateengine')
{ {
$sql = "SELECT rowid, coder"; $sql = "SELECT rowid, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity; $sql .= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code"; $sql .= " ORDER BY code";
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -109,12 +109,12 @@ elseif ($action == 'updateengine')
$code_id = $obj->rowid; $code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'"; $sqlp .= " SET coder = '".$coder."'";
$sqlp.= " WHERE rowid = ". $code_id; $sqlp .= " WHERE rowid = ".$code_id;
$sqlp.= " AND entity = ".$conf->entity; $sqlp .= " AND entity = ".$conf->entity;
$upsql=$db->query($sqlp); $upsql = $db->query($sqlp);
if (! $upsql) dol_print_error($db); if (!$upsql) dol_print_error($db);
} }
$i++; $i++;
@ -209,18 +209,18 @@ print '<td class="center" width="60">'.$langs->trans("CodeBarGenerator").'</td>'
print "</tr>\n"; print "</tr>\n";
$sql = "SELECT rowid, code as encoding, libelle as label, coder, example"; $sql = "SELECT rowid, code as encoding, libelle as label, coder, example";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity; $sql .= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code"; $sql .= " ORDER BY code";
dol_syslog("admin/barcode.php", LOG_DEBUG); dol_syslog("admin/barcode.php", LOG_DEBUG);
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -473,7 +473,7 @@ print '</td>';
print '</tr>'; print '</tr>';
// Activate FileCache - Developement // Activate FileCache - Developement
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>'; print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1); print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
print '</td>'; print '</td>';

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","companies","bills","other","banks")); $langs->loadLangs(array("admin", "companies", "bills", "other", "banks"));
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
@ -51,13 +51,13 @@ if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_AD
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstchequereceipts=GETPOST('maskconstchequereceipts', 'alpha'); $maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'alpha');
$maskchequereceipts=GETPOST('maskchequereceipts', 'alpha'); $maskchequereceipts = GETPOST('maskchequereceipts', 'alpha');
if ($maskconstchequereceipts) $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity); if ($maskconstchequereceipts) $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
if (! $error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -74,13 +74,13 @@ if ($action == 'setmod')
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
{ {
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++; if (!$res > 0) $error++;
if (! $error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -94,12 +94,12 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
* View * View
*/ */
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", $langs->trans("BankSetupModule")); llxHeader("", $langs->trans("BankSetupModule"));
$form=new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup');
$head = bank_admin_prepare_head(null); $head = bank_admin_prepare_head(null);
@ -130,25 +130,25 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle)) !== false)
{ {
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
{ {
$filebis = $file; $filebis = $file;
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = preg_replace('/\.php$/', '', $file); $classname = preg_replace('/\.php$/', '', $file);
// For compatibility // For compatibility
if (! is_file($dir.$filebis)) if (!is_file($dir.$filebis))
{ {
$filebis = $file."/".$file.".modules.php"; $filebis = $file."/".$file.".modules.php";
$classname = "mod_chequereceipt_".$file; $classname = "mod_chequereceipt_".$file;
} }
// Check if there is a filter on country // Check if there is a filter on country
preg_match('/\-(.*)_(.*)$/', $classname, $reg); preg_match('/\-(.*)_(.*)$/', $classname, $reg);
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
$classname = preg_replace('/\-.*$/', '', $classname); $classname = preg_replace('/\-.*$/', '', $classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
{ {
// Charging the numbering class // Charging the numbering class
require_once $dir.$filebis; require_once $dir.$filebis;
@ -156,13 +156,13 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db); $module = new $classname($db);
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
{ {
print '<tr class="oddeven"><td width="100">'; print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name); print (empty($module->name) ? $name : $module->name);
print "</td><td>\n"; print "</td><td>\n";
print $module->info(); print $module->info();
@ -171,9 +171,9 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module // Show example of numbering module
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp=$module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp=='NotConfigured') print $langs->trans($tmp); elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@ -188,21 +188,21 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
$chequereceipts=new RemiseCheque($db); $chequereceipts = new RemiseCheque($db);
$chequereceipts->initAsSpecimen(); $chequereceipts->initAsSpecimen();
// Example // Example
$htmltooltip=''; $htmltooltip = '';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc, $chequereceipts); $nextval = $module->getNextValue($mysoc, $chequereceipts);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=$langs->trans("NextValue").': '; $htmltooltip .= $langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval); $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip .= $nextval.'<br>';
} else { } else {
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
@ -211,7 +211,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{ {
if (! empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1); if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
} }
print '</td>'; print '</td>';
@ -247,15 +247,15 @@ print '<td class="center" width="60">&nbsp;</td>';
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
$htmltext.='</i>'; $htmltext .= '</i>';
print '<tr class="oddeven"><td colspan="2">'; print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>'; print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; $variablename = 'BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
@ -263,7 +263,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
else else
{ {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();
} }
print '</td><td class="right">'; print '</td><td class="right">';

View File

@ -40,8 +40,8 @@ $action = GETPOST('action', 'aZ09');
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$result1=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity); $result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
$result2=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity); $result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
if ($result1 >= 0 && $result2 >= 0) if ($result1 >= 0 && $result2 >= 0)
{ {
@ -60,10 +60,10 @@ if ($action == 'setvalue' && $user->admin)
$user->fetch_clicktodial(); $user->fetch_clicktodial();
$wikihelp='EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es'; $wikihelp = 'EN:Module_ClickToDial_En|FR:Module_ClickToDial|ES:Módulo_ClickTodial_Es';
llxHeader('', $langs->trans("ClickToDialSetup"), $wikihelp); llxHeader('', $langs->trans("ClickToDialSetup"), $wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ClickToDialSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("ClickToDialSetup"), $linkback, 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("ClickToDialDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("ClickToDialDesc")."</span><br>\n";
@ -90,7 +90,7 @@ print '</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("DefaultLink").'</td><td>'; print $langs->trans("DefaultLink").'</td><td>';
print '<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>'; print '<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS ? ' disabled="disabled"' : '').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
print ajax_autoselect('CLICKTODIAL_URL'); print ajax_autoselect('CLICKTODIAL_URL');
print '<br>'; print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>'; print $langs->trans("ClickToDialUrlDesc").'<br>';
@ -111,24 +111,24 @@ print '<div class="center"><br><input type="submit" class="button" value="'.$lan
print '</form><br><br>'; print '</form><br><br>';
if (! empty($conf->global->CLICKTODIAL_URL)) if (!empty($conf->global->CLICKTODIAL_URL))
{ {
$user->fetch_clicktodial(); $user->fetch_clicktodial();
$phonefortest=$mysoc->phone; $phonefortest = $mysoc->phone;
if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); if (GETPOST('phonefortest')) $phonefortest = GETPOST('phonefortest');
print '<form action="'.$_SERVER["PHP_SELF"].'">'; print '<form action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="' . newToken() . '">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print $langs->trans("LinkToTestClickToDial", $user->login).' : ';
print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">'; print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">'; print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">';
print '</form>'; print '</form>';
$setupcomplete=1; $setupcomplete = 1;
if (preg_match('/__LOGIN__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete=0; if (preg_match('/__LOGIN__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_login)) $setupcomplete = 0;
if (preg_match('/__PASSWORD__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete=0; if (preg_match('/__PASSWORD__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_password)) $setupcomplete = 0;
if (preg_match('/__PHONEFROM__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0; if (preg_match('/__PHONEFROM__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete = 0;
if ($setupcomplete) if ($setupcomplete)
{ {

View File

@ -192,7 +192,8 @@ elseif ($action == 'set_ORDER_FREE_TEXT')
{ {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == "setshippableiconinlist") { }
elseif ($action == "setshippableiconinlist") {
// Activate Set Shippable Icon In List // Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int'); $setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
@ -203,6 +204,25 @@ elseif ($action == 'set_ORDER_FREE_TEXT')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'setribchq')
{
$rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha');
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Activate ask for payment bank // Activate ask for payment bank
elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
@ -517,7 +537,122 @@ foreach ($dirmodels as $reldir)
} }
print '</table>'; print '</table>';
print "<br>";
/*
* Payment mode
*/
print '<br>';
print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInOrder"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>';
print '<input type="hidden" name="action" value="setribchq">';
print $langs->trans("PaymentMode").'</td>';
print '<td align="right">';
if (empty($conf->facture->enabled)) {
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
}
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (empty($conf->facture->enabled))
{
if (!empty($conf->banque->enabled))
{
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";
$sql .= " AND courant = 1";
$sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<select name="rib" class="flat" id="rib">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
print '>'.$row[1].'</option>';
$i++;
}
print "</select>";
}
else
{
print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
}
}
}
else
{
print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
}
}
else {
print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
}
print "</td></tr>";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
print "<td>";
if (empty($conf->facture->enabled))
{
print '<select class="flat" name="chq" id="chq">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";
$sql .= " AND courant = 1";
$sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
$i++;
}
}
print "</select>";
}
else {
print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
}
print "</td></tr>";
print "</table>";
print "</form>";
print '<br>';
/* /*
* Other options * Other options

View File

@ -46,13 +46,13 @@ $extrafields = new ExtraFields($db);
$form = new Form($db); $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label=ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label=array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->trans($val);
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype='commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield $elementtype = 'commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
@ -69,11 +69,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Receptions"); $textobject = $langs->transnoentitiesnoconv("Receptions");
llxHeader('', $langs->trans("ReceptionsSetup")); llxHeader('', $langs->trans("ReceptionsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ReceptionsSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("ReceptionsSetup"), $linkback, 'title_setup');
print "<br>\n"; print "<br>\n";
@ -114,7 +114,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -410,7 +410,7 @@ print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name // Name
@ -429,7 +429,7 @@ print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SO
// Country // Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($mysoc->country_id, 'country_id'); print $form->select_country($mysoc->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
@ -493,7 +493,7 @@ if (!empty($mysoc->logo_mini)) {
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
print '</div>'; print '</div>';
} }
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a></div>'; print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else { } else {
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">'; print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
} }
@ -511,7 +511,7 @@ if (!empty($mysoc->logo_squarred_mini)) {
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini).'">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini).'">';
print '</div>'; print '</div>';
} }
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete")).'</a></div>'; print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else { } else {
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">'; print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
} }
@ -527,13 +527,13 @@ print '</table>';
// Social networks // Social networks
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>'; print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
$listofnetworks = array('facebook'=>'facebook', 'twitter'=>'twitter', 'linkedin'=>'linkedin', 'instagram'=>'instagram', 'youtube'=>'youtube', 'github'=>'github'); $listofnetworks = array('facebook'=>'facebook', 'twitter'=>'twitter', 'linkedin'=>'linkedin', 'instagram'=>'instagram', 'youtube'=>'youtube', 'github'=>'github');
foreach($listofnetworks as $networkkey => $networkicon) { foreach ($listofnetworks as $networkkey => $networkicon) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print '<label for="'.$networkkey.'url">'.$langs->trans("SocialNetworks".ucfirst($networkkey)."URL").'</label></td><td>'; print '<label for="'.$networkkey.'url">'.$langs->trans("SocialNetworks".ucfirst($networkkey)."URL").'</label></td><td>';
$networkconst = 'MAIN_INFO_SOCIETE_'.strtoupper($networkkey).'_URL'; $networkconst = 'MAIN_INFO_SOCIETE_'.strtoupper($networkkey).'_URL';
@ -547,7 +547,7 @@ print "</table>";
print '<br>'; print '<br>';
// IDs of the company (country-specific) // IDs of the company (country-specific)
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
$langs->load("companies"); $langs->load("companies");
@ -680,7 +680,7 @@ print '</table>';
// Fiscal year start // Fiscal year start
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>'; print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
@ -695,7 +695,7 @@ print '<br>';
// Sales taxes (VAT, IRPF, ...) // Sales taxes (VAT, IRPF, ...)
print load_fiche_titre($langs->trans("TypeOfSaleTaxes")); print load_fiche_titre($langs->trans("TypeOfSaleTaxes"));
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="25%">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="25%">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
@ -721,7 +721,7 @@ print "</table>";
// Second tax // Second tax
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="25%">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="25%">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
@ -758,9 +758,9 @@ if ($mysoc->useLocalTax(1))
} else { } else {
if (empty($mysoc->country_code)) if (empty($mysoc->country_code))
{ {
print '<tr class="oddeven"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>'; print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else { } else {
print '<tr class="oddeven"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry" , $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>'; print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>';
} }
} }
@ -768,7 +768,7 @@ print "</table>";
// Third tax system // Third tax system
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="25%">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="25%">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
@ -804,18 +804,18 @@ if ($mysoc->useLocalTax(2))
} else { } else {
if (empty($mysoc->country_code)) if (empty($mysoc->country_code))
{ {
print '<tr class="oddeven"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>'; print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else { } else {
print '<tr class="oddeven"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry" , $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>'; print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>';
} }
} }
print "</table>"; print "</table>";
// Third tax system // Tax stamp
print '<br>'; print '<br>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="25%">'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>'; print '<td width="25%">'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
@ -823,7 +823,7 @@ print "</tr>\n";
if ($mysoc->useRevenueStamp()) if ($mysoc->useRevenueStamp())
{ {
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print "<tr class=\"oddeven\"><td>"; print '<tr class="oddeven"><td>';
print $langs->trans("UseRevenueStamp"); print $langs->trans("UseRevenueStamp");
print "</td>"; print "</td>";
print '<td colspan="2">'; print '<td colspan="2">';
@ -832,9 +832,9 @@ if ($mysoc->useRevenueStamp())
} else { } else {
if (empty($mysoc->country_code)) if (empty($mysoc->country_code))
{ {
print '<tr class="oddeven"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>'; print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else { } else {
print '<tr class="oddeven"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry" , $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>'; print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>';
} }
} }

View File

@ -83,7 +83,7 @@ if ($action == 'update')
} }
} }
if (! $error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -99,9 +99,9 @@ if ($action == 'update')
llxHeader(); llxHeader();
$form=new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ComptaSetup'), $linkback, 'title_setup'); print load_fiche_titre($langs->trans('ComptaSetup'), $linkback, 'title_setup');
print '<br>'; print '<br>';

View File

@ -35,7 +35,7 @@ $langs->loadLangs(array('admin', 'sendings', 'deliveries'));
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
/* /*
@ -43,7 +43,7 @@ $action=GETPOST('action', 'alpha');
*/ */
// Shipment note // Shipment note
if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{ {
// This option should always be set to on when module is on. // This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
@ -66,7 +66,7 @@ if ($action == 'disable_sending')
// Delivery note // Delivery note
if ($action == 'activate_delivery') if ($action == 'activate_delivery')
{ {
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this
dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity);
header("Location: confexped.php"); header("Location: confexped.php");
exit; exit;
@ -84,11 +84,11 @@ elseif ($action == 'disable_delivery')
*/ */
$dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/"; $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
$form=new Form($db); $form = new Form($db);
llxHeader("", $langs->trans("SendingsSetup")); llxHeader("", $langs->trans("SendingsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
print '<br>'; print '<br>';
$head = expedition_admin_prepare_head(); $head = expedition_admin_prepare_head();

View File

@ -30,22 +30,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("admin"); $langs->load("admin");
if (! $user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$rowid=GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$entity=GETPOST('entity', 'int'); $entity = GETPOST('entity', 'int');
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$update=GETPOST('update', 'alpha'); $update = GETPOST('update', 'alpha');
$delete=GETPOST('delete', 'none'); // Do not use alpha here $delete = GETPOST('delete', 'none'); // Do not use alpha here
$debug=GETPOST('debug', 'int'); $debug = GETPOST('debug', 'int');
$consts=GETPOST('const', 'array'); $consts = GETPOST('const', 'array');
$constname=GETPOST('constname', 'alphanohtml'); $constname = GETPOST('constname', 'alphanohtml');
$constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here $constvalue = GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here
$constnote=GETPOST('constnote', 'alpha'); $constnote = GETPOST('constnote', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -63,7 +63,7 @@ if (empty($sortorder)) $sortorder = 'ASC';
if ($action == 'add' || (GETPOST('add') && $action != 'update')) if ($action == 'add' || (GETPOST('add') && $action != 'update'))
{ {
$error=0; $error = 0;
if (empty($constname)) if (empty($constname))
{ {
@ -76,15 +76,15 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
$error++; $error++;
} }
if (! $error) if (!$error)
{ {
if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0) if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0)
{ {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action=""; $action = "";
$constname=""; $constname = "";
$constvalue=""; $constvalue = "";
$constnote=""; $constnote = "";
} }
else else
{ {
@ -94,12 +94,12 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
} }
// Mass update // Mass update
if (! empty($consts) && $action == 'update') if (!empty($consts) && $action == 'update')
{ {
$nbmodified=0; $nbmodified = 0;
foreach($consts as $const) foreach ($consts as $const)
{ {
if (! empty($const["check"])) if (!empty($const["check"]))
{ {
if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) >= 0) if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) >= 0)
{ {
@ -112,16 +112,16 @@ if (! empty($consts) && $action == 'update')
} }
} }
if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action=''; $action = '';
} }
// Mass delete // Mass delete
if (! empty($consts) && $action == 'delete') if (!empty($consts) && $action == 'delete')
{ {
$nbdeleted=0; $nbdeleted = 0;
foreach($consts as $const) foreach ($consts as $const)
{ {
if (! empty($const["check"])) // Is checkbox checked if (!empty($const["check"])) // Is checkbox checked
{ {
if (dolibarr_del_const($db, $const["rowid"], -1) >= 0) if (dolibarr_del_const($db, $const["rowid"], -1) >= 0)
{ {
@ -134,7 +134,7 @@ if (! empty($consts) && $action == 'delete')
} }
} }
if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
$action=''; $action = '';
} }
// Delete line from delete picto // Delete line from delete picto
@ -157,7 +157,7 @@ if ($action == 'delete')
$form = new Form($db); $form = new Form($db);
$wikihelp='EN:Setup_Other|FR:Paramétrage_Divers|ES:Configuración_Varios'; $wikihelp = 'EN:Setup_Other|FR:Paramétrage_Divers|ES:Configuración_Varios';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);
// Add logic to show/hide buttons // Add logic to show/hide buttons
@ -191,7 +191,7 @@ print "<br>\n";
$param = ''; $param = '';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" id="action" name="action" value="">'; print '<input type="hidden" id="action" name="action" value="">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
@ -204,27 +204,27 @@ print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '
print getTitleFieldOfList("Value", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print getTitleFieldOfList("Value", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print getTitleFieldOfList("Comment", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print getTitleFieldOfList("Comment", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
if (! empty($conf->multicompany->enabled) && !$user->entity) if (!empty($conf->multicompany->enabled) && !$user->entity)
{ {
print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
} }
print getTitleFieldOfList("Action", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList("", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print "</tr>\n"; print "</tr>\n";
// Line to add new record // Line to add new record
print "\n"; print "\n";
print '<tr class="oddeven"><td><input type="text" class="flat" size="24" name="constname" value="'.$constname.'"></td>'."\n"; print '<tr class="oddeven nohover"><td><input type="text" class="flat minwidth100" name="constname" value="'.$constname.'"></td>'."\n";
print '<td>'; print '<td>';
print '<input type="text" class="flat" size="30" name="constvalue" value="'.$constvalue.'">'; print '<input type="text" class="flat minwidth100" name="constvalue" value="'.$constvalue.'">';
print '</td><td>'; print '</td><td>';
print '<input type="text" class="flat" size="40" name="constnote" value="'.$constnote.'">'; print '<input type="text" class="flat minwidth100" name="constnote" value="'.$constnote.'">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '</td>'; print '</td>';
// Limit to superadmin // Limit to superadmin
if (! empty($conf->multicompany->enabled) && !$user->entity) if (!empty($conf->multicompany->enabled) && !$user->entity)
{ {
print '<td>'; print '<td>';
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">'; print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
@ -243,19 +243,19 @@ print '</tr>';
// Show constants // Show constants
$sql = "SELECT"; $sql = "SELECT";
$sql.= " rowid"; $sql .= " rowid";
$sql.= ", ".$db->decrypt('name')." as name"; $sql .= ", ".$db->decrypt('name')." as name";
$sql.= ", ".$db->decrypt('value')." as value"; $sql .= ", ".$db->decrypt('value')." as value";
$sql.= ", type"; $sql .= ", type";
$sql.= ", note"; $sql .= ", note";
$sql.= ", tms"; $sql .= ", tms";
$sql.= ", entity"; $sql .= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql .= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
elseif (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits elseif (!GETPOST('visible') || GETPOST('visible') != 'all') $sql .= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name')); if (GETPOST('name')) $sql .= natural_search("name", GETPOST('name'));
$sql.= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
dol_syslog("Const::listConstant", LOG_DEBUG); dol_syslog("Const::listConstant", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -291,7 +291,7 @@ if ($result)
print '</td>'; print '</td>';
// Entity limit to superadmin // Entity limit to superadmin
if (! empty($conf->multicompany->enabled) && !$user->entity) if (!empty($conf->multicompany->enabled) && !$user->entity)
{ {
print '<td>'; print '<td>';
print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.$obj->entity.'">'; print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.$obj->entity.'">';
@ -310,7 +310,7 @@ if ($result)
} }
else else
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} }
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -32,9 +32,9 @@ global $conf;
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","other")); $langs->loadLangs(array("admin", "other"));
$error=0; $error = 0;
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -54,7 +54,7 @@ if ($action == 'set')
$error++; $error++;
} }
if (! $error) if (!$error)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -73,14 +73,14 @@ if ($action == 'set')
llxHeader(); llxHeader();
$form=new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup');
//print load_fiche_titre($langs->trans("DebugBar")); //print load_fiche_titre($langs->trans("DebugBar"));
if (! function_exists('mb_check_encoding')) if (!function_exists('mb_check_encoding'))
{ {
$langs->load("errors"); $langs->load("errors");
print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error'); print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
@ -100,7 +100,7 @@ print '<td class="right"><input type="submit" class="button" '.$option.' value="
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").'</td>';
print '<td colspan="2"><input type="text" class="flat" name="DEBUGBAR_LOGS_LINES_NUMBER" value="'.(empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER).'">'; // This slow seriously output print '<td colspan="2"><input type="text" class="flat" name="DEBUGBAR_LOGS_LINES_NUMBER" value="'.(empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER).'">'; // This slow seriously output
print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput"); print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput");
print '</td></tr>'; print '</td></tr>';

View File

@ -134,31 +134,31 @@ $modules = array(
$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly"));
if (! isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) { if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) {
$conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php
} }
if (! isset($conf->global->MAIN_DELAY_TASKS_TODO)) { if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) {
$conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php
} }
if (! isset($conf->global->MAIN_DELAY_MEMBERS)) { if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
$conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php
} }
if (! isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) { if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
$conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php
} }
if (! isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
if (! isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7; $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
} }
if (! isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
if (! isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
if (! isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }

View File

@ -58,7 +58,7 @@ if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1
if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account
if (!$allowed) accessforbidden(); if (!$allowed) accessforbidden();
$acts =array(); $actl =array(); $acts = array(); $actl = array();
$acts[0] = "activate"; $acts[0] = "activate";
$acts[1] = "disable"; $acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off'); $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
@ -77,7 +77,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$search_country_id = GETPOST('search_country_id', 'int'); $search_country_id = GETPOST('search_country_id', 'int');
if (! GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only. if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
{ {
$search_country_id = $mysoc->country_id; $search_country_id = $mysoc->country_id;
} }
@ -445,7 +445,7 @@ $tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_
$tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled)); $tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled));
$tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled); $tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled);
$tabcond[19] = !empty($conf->societe->enabled); $tabcond[19] = !empty($conf->societe->enabled);
$tabcond[20]= (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)); $tabcond[20] = (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled));
$tabcond[21] = !empty($conf->propal->enabled); $tabcond[21] = !empty($conf->propal->enabled);
$tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled)); $tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled));
$tabcond[23] = true; $tabcond[23] = true;
@ -1718,7 +1718,7 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link

View File

@ -17,7 +17,7 @@
*/ */
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (! class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors. if (!class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors.
{ {
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php'; include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
} }

View File

@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("admin"); $langs->load("admin");
if (! $user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
/* /*
@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden();
*/ */
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code=$reg[1]; $code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
@ -50,7 +50,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code=$reg[1]; $code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
@ -67,10 +67,10 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
* View * View
*/ */
$help_url=''; $help_url = '';
llxHeader('', $langs->trans("ECMSetup"), $help_url); llxHeader('', $langs->trans("ECMSetup"), $help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
print '<br>'; print '<br>';
@ -100,7 +100,7 @@ else
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
elseif(! empty($conf->global->USER_MAIL_REQUIRED)) elseif (!empty($conf->global->USER_MAIL_REQUIRED))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} }

View File

@ -231,7 +231,7 @@ if ($action == 'confirm_collect')
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$help_url="EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector"; $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
llxHeader('', 'EmailCollector', $help_url); llxHeader('', 'EmailCollector', $help_url);
@ -577,14 +577,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty'; if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
// support hook for add action // support hook for add action
$parameters = array( 'arrayoftypes' => $arrayoftypes ) ; $parameters = array('arrayoftypes' => $arrayoftypes);
$res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action); $res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action);
if($res) if ($res)
$arrayoftypes = $hookmanager->resArray; $arrayoftypes = $hookmanager->resArray;
else else
foreach($hookmanager->resArray as $k=>$desc) foreach ($hookmanager->resArray as $k=>$desc)
$arrayoftypes[$k]=$desc; $arrayoftypes[$k] = $desc;
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300'); print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300');

View File

@ -170,7 +170,7 @@ if (empty($reshook))
$form = new Form($db); $form = new Form($db);
$help_url="EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector"; $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailCollector")); $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailCollector"));

View File

@ -28,14 +28,26 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
if (!$user->admin) if (!$user->admin) {
accessforbidden(); accessforbidden();
}
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("users", "admin", "other")); $langs->loadLangs(array("users", "admin", "other"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$securityevent = new Events($db); $securityevent = new Events($db);
$eventstolog = $securityevent->eventstolog; $eventstolog = $securityevent->eventstolog;
@ -44,6 +56,7 @@ $eventstolog = $securityevent->eventstolog;
/* /*
* Actions * Actions
*/ */
if ($action == "save") if ($action == "save")
{ {
$i = 0; $i = 0;
@ -67,6 +80,12 @@ if ($action == "save")
* View * View
*/ */
$form = new Form($db);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = '';
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; $wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
llxHeader('', $langs->trans("Audit"), $wikihelp); llxHeader('', $langs->trans("Audit"), $wikihelp);
@ -85,9 +104,10 @@ $head = security_prepare_head();
dol_fiche_head($head, 'audit', $langs->trans("Security"), -1); dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);
print "<table class=\"noborder\" width=\"100%\">"; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td colspan=\"2\">".$langs->trans("LogEvents")."</td>"; print getTitleFieldOfList("LogEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print "</tr>\n"; print "</tr>\n";
// Loop on each event type // Loop on each event type
foreach ($eventstolog as $key => $arr) foreach ($eventstolog as $key => $arr)
@ -96,10 +116,10 @@ foreach ($eventstolog as $key => $arr)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$arr['id'].'</td>'; print '<td>'.$arr['id'].'</td>';
print '<td>'; print '<td class="center">';
$key = 'MAIN_LOGEVENTS_'.$arr['id']; $key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = $conf->global->$key; $value = $conf->global->$key;
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>'; print '<input class="oddeven checkforselect" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
} }
@ -109,7 +129,7 @@ dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">"; print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</div>"; print '</div>';
print "</form>\n"; print "</form>\n";

View File

@ -37,18 +37,18 @@ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "sendings", "deliveries", "other")); $langs->loadLangs(array("admin", "sendings", "deliveries", "other"));
if (! $user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$value=GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type='shipping'; $type = 'shipping';
if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
{ {
$conf->global->EXPEDITION_ADDON_NUMBER='mod_expedition_safor'; $conf->global->EXPEDITION_ADDON_NUMBER = 'mod_expedition_safor';
} }
@ -60,9 +60,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconst=GETPOST('maskconstexpedition', 'alpha'); $maskconst = GETPOST('maskconstexpedition', 'alpha');
$maskvalue=GETPOST('maskexpedition', 'alpha'); $maskvalue = GETPOST('maskexpedition', 'alpha');
if (! empty($maskconst)) if (!empty($maskconst))
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (isset($res)) if (isset($res))
@ -76,7 +76,7 @@ if ($action == 'updateMask')
elseif ($action == 'set_param') elseif ($action == 'set_param')
{ {
$freetext=GETPOST('SHIPPING_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('SHIPPING_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if ($res <= 0) if ($res <= 0)
{ {
@ -84,7 +84,7 @@ elseif ($action == 'set_param')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('SHIPPING_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if ($res <= 0) if ($res <= 0)
{ {
@ -92,7 +92,7 @@ elseif ($action == 'set_param')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
if (! $error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -100,20 +100,20 @@ elseif ($action == 'set_param')
elseif ($action == 'specimen') elseif ($action == 'specimen')
{ {
$modele=GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$exp = new Expedition($db); $exp = new Expedition($db);
$exp->initAsSpecimen(); $exp->initAsSpecimen();
// Search template files // Search template files
$file=''; $classname=''; $filefound=0; $file = ''; $classname = ''; $filefound = 0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$file=dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound=1; $filefound = 1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break; break;
} }
@ -186,13 +186,13 @@ elseif ($action == 'setmodel')
* View * View
*/ */
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$form=new Form($db); $form = new Form($db);
llxHeader("", $langs->trans("SendingsSetup")); llxHeader("", $langs->trans("SendingsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
print '<br>'; print '<br>';
$head = expedition_admin_prepare_head(); $head = expedition_admin_prepare_head();
@ -223,11 +223,11 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle)) !== false)
{ {
if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php') if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
{ {
$file = substr($file, 0, dol_strlen($file)-4); $file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php'; require_once $dir.$file.'.php';
@ -236,7 +236,7 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled()) if ($module->isEnabled())
{ {
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
print '<tr><td>'.$module->nom."</td>\n"; print '<tr><td>'.$module->nom."</td>\n";
@ -246,11 +246,11 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module // Show example of numbering module
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp=$module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} }
elseif ($tmp=='NotConfigured') print $langs->trans($tmp); elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@ -267,21 +267,21 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
$expedition=new Expedition($db); $expedition = new Expedition($db);
$expedition->initAsSpecimen(); $expedition->initAsSpecimen();
// Info // Info
$htmltooltip=''; $htmltooltip = '';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc, $expedition); $nextval = $module->getNextValue($mysoc, $expedition);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval); $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip .= $nextval.'<br>';
} else { } else {
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
@ -307,19 +307,19 @@ print '</table><br>';
print load_fiche_titre($langs->trans("SendingsReceiptModel"), '', ''); print load_fiche_titre($langs->trans("SendingsReceiptModel"), '', '');
// Defini tableau def de modele invoice // Defini tableau def de modele invoice
$type="shipping"; $type = "shipping";
$def = array(); $def = array();
$sql = "SELECT nom"; $sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'"; $sql .= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$num_rows=$db->num_rows($resql); $num_rows = $db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows)
{ {
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
@ -346,42 +346,42 @@ clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
foreach (array('','/doc') as $valdir) foreach (array('', '/doc') as $valdir)
{ {
$dir = dol_buildpath($reldir."core/modules/expedition".$valdir); $dir = dol_buildpath($reldir."core/modules/expedition".$valdir);
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle=opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle)) !== false)
{ {
$filelist[]=$file; $filelist[] = $file;
} }
closedir($handle); closedir($handle);
arsort($filelist); arsort($filelist);
foreach($filelist as $file) foreach ($filelist as $file)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) -12); $classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db); $module = new $classname($db);
$modulequalified=1; $modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified) if ($modulequalified)
{ {
print '<tr><td width="100">'; print '<tr><td width="100">';
print (empty($module->name)?$name:$module->name); print (empty($module->name) ? $name : $module->name);
print "</td><td>\n"; print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs); if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description; else print $module->description;
@ -416,18 +416,18 @@ foreach ($dirmodels as $reldir)
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
} }
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -474,15 +474,15 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n"; print "<td>".$langs->trans("Parameter")."</td>\n";
print "</tr>"; print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
$htmltext.='</i>'; $htmltext .= '</i>';
print '<tr><td>'; print '<tr><td>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>'; print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='SHIPPING_FREE_TEXT'; $variablename = 'SHIPPING_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
@ -490,7 +490,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
else else
{ {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();
} }
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -43,13 +43,13 @@ $extrafields = new ExtraFields($db);
$form = new Form($db); $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label=ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label=array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype='expedition'; //Must be the $table_element of the class that manage extrafield $elementtype = 'expedition'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
@ -66,11 +66,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Sendings"); $textobject = $langs->transnoentitiesnoconv("Sendings");
llxHeader('', $langs->trans("SendingsSetup")); llxHeader('', $langs->trans("SendingsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
print "<br>\n"; print "<br>\n";
@ -111,7 +111,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -44,13 +44,13 @@ $extrafields = new ExtraFields($db);
$form = new Form($db); $form = new Form($db);
// List of supported format // List of supported format
$tmptype2label=ExtraFields::$type2label; $tmptype2label = ExtraFields::$type2label;
$type2label=array(''); $type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha'); $attrname = GETPOST('attrname', 'alpha');
$elementtype='expeditiondet'; //Must be the $table_element of the class that manage extrafield $elementtype = 'expeditiondet'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
@ -67,11 +67,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Sendings"); $textobject = $langs->transnoentitiesnoconv("Sendings");
llxHeader('', $langs->trans("SendingsSetup")); llxHeader('', $langs->trans("SendingsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
print "<br>\n"; print "<br>\n";
@ -112,7 +112,7 @@ if ($action == 'create')
/* Edition of an optional field */ /* Edition of an optional field */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));

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