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

View File

@ -41,7 +41,7 @@ Ace 1.4.8 BSD Yes
ChartJS 2.9.3 MIT License Yes JS library for graph
jQuery 3.4.1 MIT License Yes JS library
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 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)

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');
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- 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:

View File

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

View File

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

View File

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

View File

@ -104,6 +104,27 @@ with
//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
@ -277,3 +298,15 @@ JEDITABLE.JS
* <button type="submit" /> => <button class="button" type="submit" />
* <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.Functions.MultiLineFunctionDeclaration" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction">
<severity>0</severity>
</rule>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>

View File

@ -332,7 +332,7 @@ if ($resql)
else dol_print_error($db);
print "</select>";
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>';
@ -357,7 +357,7 @@ if ($resql)
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 ($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>';
print '<td class="liste_titre maxwidthsearch">';
$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.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 ($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);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
@ -453,11 +453,11 @@ if ($resql)
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="center">';
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 '</a>';
} 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 '</a>';
}
@ -488,11 +488,11 @@ if ($resql)
// Action
print '<td class="center">';
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 '</a>';
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 '</a>';
}

View File

@ -696,7 +696,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

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

View File

@ -408,7 +408,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
$titre = $langs->trans($tablib[$id]);
$linkback = '';
$titlepicto = 'title_setup';
$titlepicto = 'title_accountancy';
print load_fiche_titre($titre, $linkback, $titlepicto);
@ -806,7 +806,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

@ -23,12 +23,12 @@
*/
require '../../main.inc.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/class/html.formaccounting.class.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/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","admin","accountancy"));
$langs->loadLangs(array("compta", "admin", "accountancy"));
// Security check
if (empty($user->rights->accounting->chartofaccount)) {
@ -38,7 +38,7 @@ if (empty($user->rights->accounting->chartofaccount)) {
$action = GETPOST('action', 'aZ09');
$list_account_main = array (
$list_account_main = array(
'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS'
);
@ -52,23 +52,23 @@ if ($action == 'update') {
$defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha');
if (! empty($defaultjournal)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error ++;
if (!empty($defaultjournal)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error ++;
$error++;
}
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (! $error) {
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
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 '<br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
// Define main accounts for closure
@ -102,14 +102,14 @@ foreach ($list_account_main as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc=$key.'_Desc';
$keydesc = $key.'_Desc';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// 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 '</td>';
print '</tr>';
@ -117,15 +117,15 @@ foreach ($list_account_main as $key) {
// Journal
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>';
$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 '</td></tr>';
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>';

View File

@ -274,23 +274,23 @@ if ($action == 'create')
// Label
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 $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>";
// Date start
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 $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>';
// Date end
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 $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>';
// Statut

View File

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

View File

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

View File

@ -657,7 +657,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

@ -362,7 +362,6 @@ if ($result)
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
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 '<br>';
@ -412,7 +411,7 @@ if ($result)
//print '<br><div class="center">'.$buttonsave.'</div>';
$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 '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';

View File

@ -1006,7 +1006,7 @@ while ($i < min($num, $limit))
// Amount debit
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['pos'][$totalarray['nbfield']] = 'totaldebit';
$totalarray['val']['totaldebit'] += $line->debit;
@ -1015,7 +1015,7 @@ while ($i < min($num, $limit))
// Amount credit
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['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit;

View File

@ -71,9 +71,9 @@ if ($sortorder == "") $sortorder = "ASC";
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')) {
$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.= $db->plimit(1);
$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 .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
@ -220,15 +220,15 @@ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$num=count($object->lines);
$num = count($object->lines);
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;
}
if ($action == 'delbookkeepingyear') {
$form_question = array ();
$form_question = array();
$delyear = GETPOST('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="action" value="list">';
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.'">';
$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('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');
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
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);
@ -335,7 +335,7 @@ while ($i < min($num, $limit))
//if (empty($accountg)) $accountg = '-';
// 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
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>';
@ -348,7 +348,7 @@ while ($i < min($num, $limit))
$colspan = 9;
print "<tr>";
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>';
print '</td>';
print '</tr>';
@ -373,20 +373,20 @@ while ($i < min($num, $limit))
// Affiche un lien vers la facture client/fournisseur
$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->credit ? price($line->credit) : '') . '</td>';
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">' . $journaltoshow . '</td>';
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
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="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
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 '</td>';
print "</tr>\n";

View File

@ -27,22 +27,22 @@
* \brief Tab to manage customer lettering
*/
require '../../main.inc.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/lettering.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 . '/core/lib/company.lib.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/lettering.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.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","accountancy"));
$langs->loadLangs(array("compta", "accountancy"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$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;
$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>';
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();
$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.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
$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 .= " 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."' )";
/*
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);
$debit = 0;
@ -186,8 +186,8 @@ if (!$resql) {
exit();
}
$param='';
$param.="&socid=".urlencode($socid);
$param = '';
$param .= "&socid=".urlencode($socid);
$num = $db->num_rows($resql);
@ -195,10 +195,10 @@ dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEB
if ($resql) {
$i = 0;
$param="&socid=".$socid;
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="socid" value="' . $object->id . '">';
$param = "&socid=".$socid;
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="socid" value="'.$object->id.'">';
$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;
$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($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print '<tr class="oddeven">';
//print '<td>' . $obj->doc_type . '</td>' . "\n";
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . $obj->label_compte . '</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(round($solde, 2)) . '</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
print '<td>'.$obj->doc_ref.'</td>';
print '<td>'.$obj->label_compte.'</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(round($solde, 2)).'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">' . $journaltoshow . '</td>';
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
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 img_edit();
print '</a></td>' . "\n";
print '</a></td>'."\n";
} else {
print '<td class="center">' . $obj->lettering_code . '</td>';
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
@ -284,16 +284,16 @@ if ($resql) {
}
print '<tr class="oddeven">';
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($credit) . '</strong></td>';
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($credit).'</strong></td>';
print '<td colspan="4"></td>';
print "</tr>\n";
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 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 "</tr>\n";

View File

@ -26,22 +26,22 @@
* \brief Tab to setup lettering
*/
require '../../main.inc.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/lettering.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 . '/core/lib/company.lib.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/lettering.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.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","accountancy"));
$langs->loadLangs(array("compta", "accountancy"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$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;
$sortfield = GETPOST("sortfield", 'alpha');
@ -67,7 +67,7 @@ $search_doc_ref = GETPOST("search_doc_ref",'alpha');
$lettering = GETPOST('lettering', 'alpha');
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>';
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();
$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.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 .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
$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."' )";
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.entity IN ('.getEntity('accountingbookkeeping').')';
$sql.= $db->order($sortfield, $sortorder);
$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
$sql .= $db->order($sortfield, $sortorder);
$debit = 0;
$credit = 0;
@ -173,17 +173,17 @@ while ($obj = $db->fetch_object($resql)) {
$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);
$resql = $db->query($sql);
if (! $resql) {
if (!$resql) {
dol_print_error($db);
exit;
}
$param='';
$param.="&socid=".urlencode($socid);
$param = '';
$param .= "&socid=".urlencode($socid);
$num = $db->num_rows($resql);
@ -193,10 +193,10 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param="&socid=".$socid;
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="socid" value="' . $object->id . '">';
$param = "&socid=".$socid;
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="socid" value="'.$object->id.'">';
$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 '<td>' . $obj->doc_type . '</td>' . "\n";
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . $obj->label_compte . '</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(round($solde, 2)) . '</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
print '<td>'.$obj->doc_ref.'</td>';
print '<td>'.$obj->label_compte.'</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(round($solde, 2)).'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">' . $journaltoshow . '</td>';
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>' . "\n";
print '</a></td>'."\n";
} else {
print '<td class="center">' . $obj->lettering_code . '</td>';
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
@ -281,16 +281,16 @@ if ($resql) {
}
print '<tr class="oddeven">';
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($credit) . '</strong></td>';
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($credit).'</strong></td>';
print '<td colspan="6"></td>';
print "</tr>\n";
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 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 "</tr>\n";

View File

@ -24,7 +24,7 @@
*/
// 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
@ -49,12 +49,12 @@ class AccountancyCategory // extends CommonObject
/**
* @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
*/
public $table_element='c_accounting_category';
public $table_element = 'c_accounting_category';
/**
* @var int ID
@ -150,15 +150,15 @@ class AccountancyCategory // extends CommonObject
public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
$error = 0;
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
if (isset($this->code)) $this->code = trim($this->code);
if (isset($this->label)) $this->label = trim($this->label);
if (isset($this->range_account)) $this->range_account = trim($this->range_account);
if (isset($this->sens)) $this->sens = (int) $this->sens;
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->fk_country)) $this->fk_country = (int) $this->fk_country;
if (isset($this->active)) $this->active = (int) $this->active;
@ -168,47 +168,47 @@ class AccountancyCategory // extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid, ";
$sql.= "code, ";
$sql.= "label, ";
$sql.= "range_account, ";
$sql.= "sens, ";
$sql.= "category_type, ";
$sql.= "formula, ";
$sql.= "position, ";
$sql.= "fk_country, ";
$sql.= "active, ";
$sql.= "entity";
$sql.= ") VALUES (";
if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$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->sens)?'NULL':"'".$this->db->escape($this->sens)."'").",";
$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->position)?'NULL':$this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ", ".$conf->entity;
$sql.= ")";
if ($this->rowid > 0) $sql .= "rowid, ";
$sql .= "code, ";
$sql .= "label, ";
$sql .= "range_account, ";
$sql .= "sens, ";
$sql .= "category_type, ";
$sql .= "formula, ";
$sql .= "position, ";
$sql .= "fk_country, ";
$sql .= "active, ";
$sql .= "entity";
$sql .= ") VALUES (";
if ($this->rowid > 0) $sql .= " ".$this->rowid.",";
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
$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->sens) ? 'NULL' : "'".$this->db->escape($this->sens)."'").",";
$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->position) ? 'NULL' : $this->db->escape($this->position)).",";
$sql .= " ".(!isset($this->fk_country) ? 'NULL' : $this->db->escape($this->fk_country)).",";
$sql .= " ".(!isset($this->active) ? 'NULL' : $this->db->escape($this->active));
$sql .= ", ".$conf->entity;
$sql .= ")";
$this->db->begin();
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1*$error;
return -1 * $error;
}
else
{
@ -229,27 +229,27 @@ class AccountancyCategory // extends CommonObject
public function fetch($id, $code = '', $label = '')
{
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.label,";
$sql.= " t.range_account,";
$sql.= " t.sens,";
$sql.= " t.category_type,";
$sql.= " t.formula,";
$sql.= " t.position,";
$sql.= " t.fk_country,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
$sql .= " t.rowid,";
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.range_account,";
$sql .= " t.sens,";
$sql .= " t.category_type,";
$sql .= " t.formula,";
$sql .= " t.position,";
$sql .= " t.fk_country,";
$sql .= " t.active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql .= " WHERE t.rowid = ".$id;
else
{
$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)."'";
elseif ($label) $sql.= " AND t.label = '".$this->db->escape($label)."'";
$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)."'";
elseif ($label) $sql .= " AND t.label = '".$this->db->escape($label)."'";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
@ -273,7 +273,7 @@ class AccountancyCategory // extends CommonObject
}
else
{
$this->error="Error ".$this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
return -1;
}
}
@ -289,15 +289,15 @@ class AccountancyCategory // extends CommonObject
public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error=0;
$error = 0;
// Clean parameters
if (isset($this->code)) $this->code=trim($this->code);
if (isset($this->label)) $this->label=trim($this->label);
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
if (isset($this->code)) $this->code = trim($this->code);
if (isset($this->label)) $this->label = trim($this->label);
if (isset($this->range_account)) $this->range_account = trim($this->range_account);
if (isset($this->sens)) $this->sens = (int) $this->sens;
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->fk_country)) $this->fk_country = (int) $this->fk_country;
if (isset($this->active)) $this->active = (int) $this->active;
@ -308,33 +308,33 @@ class AccountancyCategory // extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."c_accounting_category SET";
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"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.= " sens=".(isset($this->sens)?$this->sens:"null").",";
$sql.= " category_type=".(isset($this->category_type)?$this->category_type:"null").",";
$sql.= " formula=".(isset($this->formula)?"'".$this->db->escape($this->formula)."'":"null").",";
$sql.= " position=".(isset($this->position)?$this->position:"null").",";
$sql.= " fk_country=".(isset($this->fk_country)?$this->fk_country:"null").",";
$sql.= " active=".(isset($this->active)?$this->active:"null")."";
$sql.= " WHERE rowid=".$this->id;
$sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "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 .= " sens=".(isset($this->sens) ? $this->sens : "null").",";
$sql .= " category_type=".(isset($this->category_type) ? $this->category_type : "null").",";
$sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").",";
$sql .= " position=".(isset($this->position) ? $this->position : "null").",";
$sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
$sql .= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$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
if ($error)
{
foreach($this->errors as $errmsg)
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1*$error;
return -1 * $error;
}
else
{
@ -354,27 +354,27 @@ class AccountancyCategory // extends CommonObject
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error=0;
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category";
$sql.= " WHERE rowid=".$this->id;
$sql .= " WHERE rowid=".$this->id;
$this->db->begin();
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$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
if ($error)
{
foreach($this->errors as $errmsg)
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1*$error;
return -1 * $error;
}
else
{
@ -394,28 +394,28 @@ class AccountancyCategory // extends CommonObject
{
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$id;
$sql .= " AND t.entity = ".$conf->entity;
$this->lines_display = array();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_display[] = $obj;
}
}
return $num;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$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;
$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 .= " SELECT t.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id . " AND t.entity = " . $conf->entity.")";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$id." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN (";
$sql .= " SELECT DISTINCT aa.account_number";
$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 .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$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 .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$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 .= " ORDER BY t.numero_compte";
$this->lines_CptBk = array ();
$this->lines_CptBk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
return $num;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$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;
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$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 .= " 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 .= " 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.entity = " . $conf->entity;
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP 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);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
return $num;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$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';
$sql = "SELECT aa.rowid, aa.account_number";
$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 .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$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 .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$this->db->begin();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
$this->db->rollback();
return -1;
}
$accountincptsadded=array();
$accountincptsadded = array();
while ($obj = $this->db->fetch_object($resql))
{
$account_number_formated=length_accountg($obj->account_number);
if (! empty($accountincptsadded[$account_number_formated])) continue;
$account_number_formated = length_accountg($obj->account_number);
if (!empty($accountincptsadded[$account_number_formated])) continue;
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
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
$sql .= " SET fk_accounting_category=" . $id_cat;
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
$sql .= " SET fk_accounting_category=".$id_cat;
$sql .= " WHERE rowid=".$obj->rowid;
dol_syslog(__METHOD__, LOG_DEBUG);
$resqlupdate = $this->db->query($sql);
if (! $resqlupdate) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
if (!$resqlupdate) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
}
@ -570,12 +570,12 @@ class AccountancyCategory // extends CommonObject
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
return -1 * $error;
} else {
$this->db->commit();
@ -594,27 +594,27 @@ class AccountancyCategory // extends CommonObject
{
$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 .= " WHERE aa.rowid= " . $cpt_id;
$sql .= " WHERE aa.rowid= ".$cpt_id;
$this->db->begin();
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
$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
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
return -1 * $error;
} else {
$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 .= " 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 .= " 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 .= " 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 cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
@ -652,11 +652,11 @@ class AccountancyCategory // extends CommonObject
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
$data = array();
if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) {
while ($obj = $this->db->fetch_object($resql)) {
$name_cat = $obj->name_cat;
$data[$name_cat][$i] = array (
$data[$name_cat][$i] = array(
'id' => $obj->rowid,
'code' => $obj->code,
'position' => $obj->position,
@ -664,13 +664,13 @@ class AccountancyCategory // extends CommonObject
'account_label' => $obj->account_label,
'sens' => $obj->sens
);
$i ++;
$i++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
@ -696,34 +696,34 @@ class AccountancyCategory // extends CommonObject
$this->sdcpermonth = array();
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
if (is_array($cpt)) $sql.=", t.numero_compte as accountancy_account";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
if (is_array($cpt)) $sql .= ", t.numero_compte as accountancy_account";
$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';
$sql .= " WHERE t.entity = ".$conf->entity;
if (is_array($cpt))
{
$listofaccount='';
foreach($cpt as $cptcursor)
$listofaccount = '';
foreach ($cpt as $cptcursor)
{
if ($listofaccount) $listofaccount.=",";
$listofaccount.="'".$cptcursor."'";
if ($listofaccount) $listofaccount .= ",";
$listofaccount .= "'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (" .$listofaccount. ")";
$sql .= " AND t.numero_compte IN (".$listofaccount.")";
}
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)."')";
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))."')";
}
if ($thirdparty_code != 'nofilter')
{
$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;
$resql = $this->db->query($sql);
@ -745,9 +745,9 @@ class AccountancyCategory // extends CommonObject
}
return $num;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
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 .= " 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 .= " AND c.entity = " . $conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND c.entity = ".$conf->entity;
if ($categorytype >= 0) $sql .= " AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " ORDER BY c.position ASC";
@ -780,12 +780,12 @@ class AccountancyCategory // extends CommonObject
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
$data = array();
if ($num) {
while ( $i < $num ) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$data[] = array (
$data[] = array(
'rowid' => $obj->rowid,
'code' => $obj->code,
'label' => $obj->label,
@ -799,11 +799,11 @@ class AccountancyCategory // extends CommonObject
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$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();
}
if (! empty($cat_id))
if (!empty($cat_id))
{
$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 .= " AND t.entity = " . $conf->entity;
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY t.account_number";
}
else
{
$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 .= " AND t.entity = " . $conf->entity;
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY t.account_number";
}
//echo $sql;
@ -853,7 +853,7 @@ class AccountancyCategory // extends CommonObject
if ($num) {
while ($obj = $this->db->fetch_object($resql))
{
$data[] = array (
$data[] = array(
'id' => $obj->rowid,
'account_number' => $obj->account_number,
'account_label' => $obj->account_label,
@ -863,8 +863,8 @@ class AccountancyCategory // extends CommonObject
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}

View File

@ -1079,28 +1079,28 @@ class AccountancyExport
foreach ($objectLines as $line) {
// TYPE C
if($last_codeinvoice != $line->doc_ref){
if ($last_codeinvoice != $line->doc_ref) {
//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);
if($resql && $this->db->num_rows($resql)>0)
if ($resql && $this->db->num_rows($resql) > 0)
{
$soc = $this->db->fetch_object($resql);
$address=array('','','');
if (strpos($soc->address, "\n")!==false) {
$address = array('', '', '');
if (strpos($soc->address, "\n") !== false) {
$address = explode("\n", $soc->address);
if (is_array($address) && count($address)>0) {
foreach($address as $key=>$data) {
$address[$key]=str_replace(array("\t", "\n", "\r"), "", $data);
$address[$key]=dol_trunc($address[$key], 40, 'right', 'UTF-8', 1);
if (is_array($address) && count($address) > 0) {
foreach ($address as $key=>$data) {
$address[$key] = str_replace(array("\t", "\n", "\r"), "", $data);
$address[$key] = dol_trunc($address[$key], 40, 'right', 'UTF-8', 1);
}
}
} else {
$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[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 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[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40);
}
$type_enregistrement = 'C';
@ -1254,7 +1254,7 @@ class AccountancyExport
$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
print price(abs($line->montant), 0, '', 1, 2).$separator;
// CODC

View File

@ -98,15 +98,15 @@ class AccountancySystem
if ($rowid > 0 || $ref)
{
$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";
if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'";
$sql .= " a.rowid = '".$rowid."'";
} 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);
if ($result) {
$obj = $this->db->fetch_object($result);
@ -124,11 +124,11 @@ class AccountancySystem
return 0;
}
} else {
$this->error = "Error " . $this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
}
}
return - 1;
return -1;
}
@ -142,14 +142,14 @@ class AccountancySystem
{
$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 .= " 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);
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) {
$this->rowid = $id;

View File

@ -34,12 +34,12 @@ class AccountingAccount extends CommonObject
/**
* @var string Name of element
*/
public $element='accounting_account';
public $element = 'accounting_account';
/**
* @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
@ -150,7 +150,7 @@ class AccountingAccount extends CommonObject
global $conf;
$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) {
$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 .= " 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 .= " WHERE";
if ($rowid) {
$sql .= " a.rowid = " . (int) $rowid;
$sql .= " a.rowid = ".(int) $rowid;
} 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;
}
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) . ')';
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).')';
}
if (! empty($limittoachartaccount)) {
if (!empty($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);
if ($result) {
$obj = $this->db->fetch_object($result);
@ -215,8 +215,8 @@ class AccountingAccount extends CommonObject
return 0;
}
} else {
$this->error = "Error " . $this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
}
}
return -1;
@ -255,7 +255,7 @@ class AccountingAccount extends CommonObject
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_account(";
$sql .= "datec";
$sql .= ", entity";
$sql .= ", fk_pcg_version";
@ -269,31 +269,31 @@ class AccountingAccount extends CommonObject
$sql .= ", active";
$sql .= ", reconcilable";
$sql .= ") VALUES (";
$sql .= " '" . $this->db->idate($now) . "'";
$sql .= ", " . $conf->entity;
$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->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent);
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (empty($this->labelshort) ? "''" : "'" . $this->db->escape($this->labelshort) . "'");
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", " . $user->id;
$sql .= ", " . (int) $this->active;
$sql .= ", " . (int) $this->reconcilable;
$sql .= " '".$this->db->idate($now)."'";
$sql .= ", ".$conf->entity;
$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->account_number) ? 'NULL' : "'".$this->db->escape($this->account_number)."'");
$sql .= ", ".(empty($this->account_parent) ? 0 : (int) $this->account_parent);
$sql .= ", ".(empty($this->label) ? "''" : "'".$this->db->escape($this->label)."'");
$sql .= ", ".(empty($this->labelshort) ? "''" : "'".$this->db->escape($this->labelshort)."'");
$sql .= ", ".(empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", ".$user->id;
$sql .= ", ".(int) $this->active;
$sql .= ", ".(int) $this->reconcilable;
$sql .= ")";
$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);
if (! $resql) {
if (!$resql) {
$error++;
$this->errors[] = "Error " . $this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
}
if (! $error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account");
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_account");
// Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger.
@ -309,8 +309,8 @@ class AccountingAccount extends CommonObject
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
@ -336,20 +336,20 @@ class AccountingAccount extends CommonObject
$this->db->begin();
$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 .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null");
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
$sql .= " , account_parent = " . (int) $this->account_parent;
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''");
$sql .= " , labelshort = " . ($this->labelshort ? "'" . $this->db->escape($this->labelshort) . "'" : "''");
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = " . (int) $this->active;
$sql .= " , reconcilable = " . (int) $this->reconcilable;
$sql .= " WHERE rowid = " . $this->id;
$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 .= " , pcg_type = ".($this->pcg_type ? "'".$this->db->escape($this->pcg_type)."'" : "null");
$sql .= " , account_number = '".$this->db->escape($this->account_number)."'";
$sql .= " , account_parent = ".(int) $this->account_parent;
$sql .= " , label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "''");
$sql .= " , labelshort = ".($this->labelshort ? "'".$this->db->escape($this->labelshort)."'" : "''");
$sql .= " , fk_accounting_category = ".(empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= " , fk_user_modif = ".$user->id;
$sql .= " , active = ".(int) $this->active;
$sql .= " , reconcilable = ".(int) $this->reconcilable;
$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);
if ($result) {
$this->db->commit();
@ -357,7 +357,7 @@ class AccountingAccount extends CommonObject
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return - 1;
return -1;
}
}
@ -370,13 +370,13 @@ class AccountingAccount extends CommonObject
{
global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
$sql.= " WHERE fk_code_ventilation=" . $this->id . ")";
$sql.= "UNION";
$sql.= " (SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql.= " WHERE fk_code_ventilation=" . $this->id . ")";
$sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet";
$sql .= " WHERE fk_code_ventilation=".$this->id.")";
$sql .= "UNION";
$sql .= " (SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facture_fourn_det";
$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);
if ($resql) {
@ -389,7 +389,7 @@ class AccountingAccount extends CommonObject
}
} else {
$this->error = $this->db->lasterror();
return - 1;
return -1;
}
}
@ -409,32 +409,32 @@ class AccountingAccount extends CommonObject
if ($result > 0) {
$this->db->begin();
if (! $error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account";
$sql .= " WHERE rowid=" . $this->id;
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."accounting_account";
$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);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
return -1 * $error;
} else {
$this->db->commit();
return 1;
}
} else {
return - 1;
return -1;
}
}
@ -455,19 +455,19 @@ class AccountingAccount extends CommonObject
global $langs, $conf, $user;
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 = '';
$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_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
$picto = 'billr';
$label='';
$label = '';
if (empty($this->labelshort) || $withcompletelabel == 1)
{
@ -476,28 +476,28 @@ class AccountingAccount extends CommonObject
$labeltoshow = $this->labelshort;
}
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>';
if (! empty($this->account_number))
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
if (! empty($labeltoshow))
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $labeltoshow;
if ($moretitle) $label.=' - '.$moretitle;
$label = '<u>'.$langs->trans("ShowAccountingAccount").'</u>';
if (!empty($this->account_number))
$label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);
if (!empty($labeltoshow))
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
if ($moretitle) $label .= ' - '.$moretitle;
$linkclose='';
$linkclose = '';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowAccoutingAccount");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
$label = $langs->trans("ShowAccoutingAccount");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip"';
}
$linkstart='<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
$linkend = '</a>';
if ($nourl)
{
@ -507,11 +507,11 @@ class AccountingAccount extends CommonObject
}
$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 != 2) $result.=$linkstart . $label_link . $linkend;
if ($withpicto != 2) $result .= $linkstart.$label_link.$linkend;
return $result;
}
@ -524,10 +524,10 @@ class AccountingAccount extends CommonObject
public function info($id)
{
$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 .= ' WHERE a.rowid = ' . $id;
$sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a';
$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);
if ($result) {
@ -578,11 +578,11 @@ class AccountingAccount extends CommonObject
if ($result > 0) {
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
$sql .= "SET " . $fieldtouse . " = '0'";
$sql .= " WHERE rowid = " . $this->db->escape($id);
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET ".$fieldtouse." = '0'";
$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);
if ($result) {
@ -591,10 +591,10 @@ class AccountingAccount extends CommonObject
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return - 1;
return -1;
}
} else {
return - 1;
return -1;
}
}
@ -620,11 +620,11 @@ class AccountingAccount extends CommonObject
$fieldtouse = 'reconcilable';
}
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
$sql .= "SET " . $fieldtouse . " = '1'";
$sql .= " WHERE rowid = " . $this->db->escape($id);
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET ".$fieldtouse." = '1'";
$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);
if ($result) {
$this->db->commit();
@ -632,7 +632,7 @@ class AccountingAccount extends CommonObject
} else {
$this->error = $this->db->lasterror();
$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->fk_doc;
$sql .= ", ".$this->fk_docdet;
$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_label)?("'".$this->db->escape($this->subledger_label)."'"):"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_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL");
$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->debit;
$sql .= ", ".$this->credit;
$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->idate($now)."'";
$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 .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
$sql .= ")";
@ -1397,7 +1397,7 @@ class BookKeeping extends CommonObject
$sql = "DELETE";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$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)."'";
$sql .= " AND entity IN (".getEntity('accountancy').")";

View File

@ -24,9 +24,9 @@
* \brief File of class for lettering
*/
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 . "/core/lib/date.lib.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."/core/lib/date.lib.php";
/**
* 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 .= " 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 .= " 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 .= " 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 .= " WHERE ( ";
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 != "")
$sql .= " OR ";
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.lettering_code != '' OR bk.lettering_code IS NULL) ";
@ -85,127 +85,127 @@ class Lettering extends BookKeeping
if ($resql) {
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql) ) {
while ($obj = $this->db->fetch_object($resql)) {
$ids = array();
$ids_fact = array();
if ($obj->type == 'payment_supplier')
{
$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 .= " 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 . "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 .= " 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 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 .= " WHERE payfacf.fk_paiementfourn = '".$obj->url_id."' ";
$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 ( ";
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 != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
$sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
}
$sql .= " ) ";
$resql2 = $this->db->query($sql);
if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) {
while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid;
$ids_fact[] = $obj2->fact_id;
}
} else {
$this->errors[] = $this->db->lasterror;
return - 1;
return -1;
}
if (count($ids_fact)) {
$sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier ';
$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 .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3 AND entity=".$conf->entity.") ";
$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 .= " 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 ( ";
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 != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
$sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
}
$sql .= ") ";
$resql2 = $this->db->query($sql);
if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) {
while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid;
}
} else {
$this->errors[] = $this->db->lasterror;
return - 1;
return -1;
}
}
} elseif ($obj->type == 'payment') {
$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 .= " 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 . "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 .= " 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 .= " 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 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 .= " 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 fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND ( ";
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 != "") {
$sql .= " OR ";
}
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);
if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) {
while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid;
$ids_fact[] = $obj2->fact_id;
}
} else {
$this->errors[] = $this->db->lasterror;
return - 1;
return -1;
}
if (count($ids_fact)) {
$sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier ';
$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 .= " 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 .= " 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 .= " 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 ( ";
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 != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
$sql .= " bk.subledger_account = '".$object->code_compta_fournisseur."' ";
}
$sql .= " ) ";
$resql2 = $this->db->query($sql);
if ($resql2) {
while ( $obj2 = $this->db->fetch_object($resql2) ) {
while ($obj2 = $this->db->fetch_object($resql2)) {
$ids[$obj2->rowid] = $obj2->rowid;
}
} else {
$this->errors[] = $this->db->lasterror;
return - 1;
return -1;
}
}
}
@ -217,10 +217,10 @@ class Lettering extends BookKeeping
}
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::" . __METHOD__ . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(__METHOD__.' '.$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
return - 1 * $error;
return -1 * $error;
} else {
return 1;
}
@ -237,33 +237,31 @@ class Lettering extends BookKeeping
$error = 0;
$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; ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
if (! empty($obj->lettering_code))
if (!empty($obj->lettering_code))
$lettre++;
} else {
$this->errors[] = 'Error' . $this->db->lasterror();
$this->errors[] = 'Error'.$this->db->lasterror();
$error++;
}
$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 = "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 ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
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);
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);
$error++;
}
} else {
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
$this->errors[] = 'Erreur sql'.$this->db->lasterror();
$error++;
}
@ -271,30 +269,30 @@ class Lettering extends BookKeeping
$now = dol_now();
if (! $error)
if (!$error)
{
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
$sql .= " lettering_code='" . $lettre . "'";
$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 = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
$sql .= " lettering_code='".$lettre."'";
$sql .= " , date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false
$sql .= " WHERE rowid IN (".implode(',', $ids).") AND date_validated IS NULL ";
$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);
if (! $resql) {
if (!$resql) {
$error++;
$this->errors[] = "Error " . $this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
return -1 * $error;
} else {
$this->db->commit();
return 1;

View File

@ -167,7 +167,7 @@ if ($action == 'validatehistory') {
$suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$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';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra;

View File

@ -499,7 +499,7 @@ if ($result) {
$suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$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';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$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
} else {
$code_sell_p_notset = 'color:orange';
@ -567,12 +567,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
// 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>';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
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);
if ($objp->product_id > 0)
{
@ -583,7 +583,7 @@ if ($result) {
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
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 '</td>';
@ -595,7 +595,7 @@ if ($result) {
/*var_dump($suggestedid);
var_dump($objp->code_sell_p);
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]))
{
@ -632,7 +632,7 @@ if ($result) {
print $db->error();
}
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

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 '<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 '<hr>';

View File

@ -31,37 +31,37 @@
* \brief Page with bank journal
*/
require '../../main.inc.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/bank.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/accountingjournal.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 . '/adherents/class/adherent.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 . '/don/class/don.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 . '/salaries/class/paymentsalary.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/fournisseur.facture.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 . '/societe/class/client.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 . '/compta/bank/class/paymentvarious.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/paymentloan.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.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/bank.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/accountingjournal.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.'/adherents/class/adherent.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.'/don/class/don.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.'/salaries/class/paymentsalary.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/fournisseur.facture.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.'/societe/class/client.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.'/compta/bank/class/paymentvarious.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/paymentloan.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// 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
$id_journal = GETPOST('id_journal', 'int');
@ -95,13 +95,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear --;
$pastmonthyear--;
}
$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);
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_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 .= " 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 .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$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 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 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 . "user as u on bu2.url_id=u.rowid";
$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 .= " FROM ".MAIN_DB_PREFIX."bank as b";
$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 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 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."user as u on bu2.url_id=u.rowid";
$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
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
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')
{
$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";
//print $sql;
@ -149,7 +149,7 @@ $paymentsalstatic = new PaymentSalary($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
$paymentvariousstatic = new PaymentVarious($db);
$paymentloanstatic = new PaymentLoan($db);
$accountLinestatic=new AccountLine($db);
$accountLinestatic = new AccountLine($db);
$paymentsubscriptionstatic = new Subscription($db);
$tmppayment = new Paiement($db);
@ -171,20 +171,20 @@ if ($result) {
//print $sql;
// Variables
$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_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_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_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : '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_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_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_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
$tabcompany = array();
$tabuser = array();
$tabpay = array ();
$tabbq = array ();
$tabtp = array ();
$tabtype = array ();
$tabpay = array();
$tabbq = array();
$tabtp = array();
$tabtype = array();
$tabmoreinfo = array();
// Loop on each line into llx_bank table. For each line, we should get:
@ -199,8 +199,8 @@ if ($result) {
$lineisapurchase = -1;
$lineisasale = -1;
// Old method to detect if it's a sale or purchase
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 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
if ($lineisapurchase < 0)
{
@ -221,9 +221,9 @@ if ($result) {
if ($lineisapurchase > 0)
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
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,
'name' => $obj->name,
'code_compta' => $compta_soc,
@ -231,9 +231,9 @@ if ($result) {
);
// 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,
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
'lastname' => $obj->lastname,
@ -244,8 +244,8 @@ if ($result) {
// Variable bookkeeping ($obj->rowid is Bank Id)
$tabpay[$obj->rowid]["date"] = $obj->do;
$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]["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]["fk_bank"] = $obj->rowid;
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
@ -254,14 +254,14 @@ if ($result) {
} else {
$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($tabpay);
//var_dump($tabcompany);
// 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';
$tabmoreinfo[$obj->rowid] = array();
@ -287,18 +287,18 @@ if ($result) {
}
if ($links[$key]['type'] == 'withdraw') {
$tabmoreinfo[$obj->rowid]['withdraw']=1;
$tabmoreinfo[$obj->rowid]['withdraw'] = 1;
}
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $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;
} elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $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;
} elseif ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id'];
@ -313,13 +313,13 @@ if ($result) {
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
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;
} elseif ($links[$key]['type'] == 'sc') {
$chargestatic->id = $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 ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
@ -332,13 +332,13 @@ if ($result) {
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$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 . "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 .= " WHERE bkurl.fk_bank=" . $obj->rowid;
$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."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 .= " 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);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
@ -348,14 +348,14 @@ if ($result) {
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->ref = $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;
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
} elseif ($links[$key]['type'] == 'member') {
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
$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;
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
@ -363,14 +363,14 @@ if ($result) {
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$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;
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$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;
} elseif ($links[$key]['type'] == 'payment_expensereport') {
$paymentexpensereportstatic->id = $links[$key]['url_id'];
@ -380,25 +380,25 @@ if ($result) {
$paymentvariousstatic->id = $links[$key]['url_id'];
$paymentvariousstatic->ref = $links[$key]['url_id'];
$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;
$paymentvariousstatic->fetch($paymentvariousstatic->id);
$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_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
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $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;
//$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.= ' 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 .= ' 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;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
@ -408,7 +408,7 @@ if ($result) {
}
} elseif ($links[$key]['type'] == 'banktransfert') {
$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;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$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.
// 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) {
if ($links[$key]['type'] == 'payment') {
// Get thirdparty
$tmppayment->fetch($links[$key]['url_id']);
$arrayofamounts = $tmppayment->getAmountsArray();
foreach($arrayofamounts as $invoiceid => $amount)
foreach ($arrayofamounts as $invoiceid => $amount)
{
$tmpinvoice->fetch($invoiceid);
$tmpinvoice->fetch_thirdparty();
@ -478,7 +478,7 @@ var_dump($tabtp);
var_dump($tabtype);*/
// Write bookkeeping
if (! $error && $action == 'writebookkeeping') {
if (!$error && $action == 'writebookkeeping') {
$now = dol_now();
$error = 0;
@ -501,7 +501,7 @@ if (! $error && $action == 'writebookkeeping') {
var_dump($tabbq);exit;*/
// Bank
if (! $errorforline && is_array($tabbq[$key]))
if (!$errorforline && is_array($tabbq[$key]))
{
// Line into bank account
foreach ($tabbq[$key] as $k => $mt)
@ -509,9 +509,9 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@ -528,7 +528,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt < 0 ? -$mt : 0);
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
@ -562,7 +562,7 @@ if (! $error && $action == 'writebookkeeping') {
}
// Third party
if (! $errorforline)
if (!$errorforline)
{
if (is_array($tabtp[$key]))
{
@ -571,14 +571,14 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt)
{
$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')
{
$reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
}
else
{
$reflabel.= dol_string_nohtmltag($val['soclib']);
$reflabel .= dol_string_nohtmltag($val['soclib']);
}
$bookkeeping = new BookKeeping($db);
@ -590,7 +590,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->label_operation = $reflabel;
$bookkeeping->montant = $mt;
$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->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
@ -598,15 +598,15 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
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_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
$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->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label;
} 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_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
$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->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
@ -715,8 +715,8 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= dol_string_nohtmltag('WaitingAccount');
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= dol_string_nohtmltag('WaitingAccount');
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@ -726,7 +726,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->montant = $mt;
$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->code_journal = $journal;
$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');
}
if (! $errorforline)
if (!$errorforline)
{
$db->commit();
}
@ -776,11 +776,11 @@ if (! $error && $action == 'writebookkeeping') {
//print 'KO for line '.$key.' '.$error.'<br>';
$db->rollback();
$MAXNBERRORS=5;
$MAXNBERRORS = 5;
if ($error >= $MAXNBERRORS)
{
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
if (count($tabpay) != $error)
{
$param='id_journal='.$id_journal;
$param.='&date_startday='.$date_startday;
$param.='&date_startmonth='.$date_startmonth;
$param.='&date_startyear='.$date_startyear;
$param.='&date_endday='.$date_endday;
$param.='&date_endmonth='.$date_endmonth;
$param.='&date_endyear='.$date_endyear;
$param.='&in_bookkeeping='.$in_bookkeeping;
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
$param = 'id_journal='.$id_journal;
$param .= '&date_startday='.$date_startday;
$param .= '&date_startmonth='.$date_startmonth;
$param .= '&date_startyear='.$date_startyear;
$param .= '&date_endday='.$date_endday;
$param .= '&date_endmonth='.$date_endmonth;
$param .= '&date_endyear='.$date_endyear;
$param .= '&in_bookkeeping='.$in_bookkeeping;
header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
exit;
}
}
@ -823,20 +823,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$filename = '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
print '"' . $langs->transnoentitiesnoconv("BankId").'"' . $sep;
print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("PaymentMode") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("LedgerAccount") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("SubledgerAccount") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("Label"). '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("Journal") . '"' . $sep;
print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep;
print '"'.$langs->transnoentitiesnoconv("BankId").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Date").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("PaymentMode").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
print "\n";
foreach ($tabpay as $key => $val)
@ -850,21 +850,21 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print " " . $sep;
print '"' . $reflabel . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print " ".$sep;
print '"'.$reflabel.'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.$journal.'"'.$sep;
print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n";
}
}
@ -875,37 +875,37 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt)
{
$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')
{
$reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
}
else
{
$reflabel.= dol_string_nohtmltag($val['soclib']);
$reflabel .= dol_string_nohtmltag($val['soclib']);
}
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} elseif($tabtype[$key] == 'payment') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
} elseif($tabtype[$key] == 'payment_expensereport') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
} elseif($tabtype[$key] == 'payment_salary') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
} elseif ($tabtype[$key] == 'payment') {
print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
} elseif ($tabtype[$key] == 'payment_expensereport') {
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} elseif ($tabtype[$key] == 'payment_salary') {
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} 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 '"' . $reflabel . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$reflabel.'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.$journal.'"'.$sep;
print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n";
}
}
@ -914,20 +914,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= dol_string_nohtmltag('WaitingAccount');
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
$reflabel .= dol_string_nohtmltag('WaitingAccount');
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $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 "" . $sep;
print '"' . $reflabel . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$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 "".$sep;
print '"'.$reflabel.'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.$journal.'"'.$sep;
print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n";
}
}
@ -954,16 +954,16 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$builddate=dol_now();
$nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$builddate = dol_now();
//$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"));
$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);
$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 .= ' - '.$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);
@ -994,15 +994,15 @@ if (empty($action) || $action == 'view') {
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'
|| ($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 {
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>';
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>';
}
print '</div>';
@ -1033,14 +1033,14 @@ if (empty($action) || $action == 'view') {
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>" . $langs->trans("Date") . "</td>";
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $langs->trans("LabelOperation") . "</td>";
print '<td class="center">' . $langs->trans("PaymentMode") . "</td>";
print '<td class="right">' . $langs->trans("Debit") . "</td>";
print '<td class="right">' . $langs->trans("Credit") . "</td>";
print "<td>".$langs->trans("Date")."</td>";
print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>";
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("PaymentMode")."</td>";
print '<td class="right">'.$langs->trans("Debit")."</td>";
print '<td class="right">'.$langs->trans("Credit")."</td>";
print "</tr>\n";
$r = '';
@ -1057,15 +1057,15 @@ if (empty($action) || $action == 'view') {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
$reflabel.= $langs->trans("Bank").' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) $reflabel .= " - " . $val['soclib'];
if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
$reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref'];
if (!empty($val['soclib'])) $reflabel .= " - ".$val['soclib'];
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
print "<td>".$date."</td>";
print "<td>".$ref."</td>";
// Ledger account
print "<td>";
$accounttoshow = length_accountg($k);
@ -1087,9 +1087,9 @@ if (empty($action) || $action == 'view') {
print "<td>";
print $reflabel;
print "</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="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 "</tr>";
}
}
@ -1100,20 +1100,20 @@ if (empty($action) || $action == 'view') {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":"");
if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert')
{
$reflabel.= $langs->trans('TransitionalAccount').' '.$account_transfer;
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
}
else
{
$reflabel.= $val['soclib'];
$reflabel .= $val['soclib'];
}
print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
print "<td>".$date."</td>";
print "<td>".$ref."</td>";
// Ledger account
print "<td>";
$account_ledger = $k;
@ -1137,19 +1137,19 @@ if (empty($action) || $action == 'view') {
}
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
{
// We will refuse writing
$errorstring='UnknownAccountForThirdpartyBlocking';
if ($tabtype[$key] == 'payment') $errorstring='MainAccountForCustomersNotDefined';
if ($tabtype[$key] == 'payment_supplier') $errorstring='MainAccountForSuppliersNotDefined';
if ($tabtype[$key] == 'payment_expensereport') $errorstring='MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_salary') $errorstring='MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_vat') $errorstring='MainAccountForVatPaymentNotDefined';
if ($tabtype[$key] == 'member') $errorstring='MainAccountForSubscriptionPaymentNotDefined';
$errorstring = 'UnknownAccountForThirdpartyBlocking';
if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined';
if ($tabtype[$key] == 'payment_supplier') $errorstring = 'MainAccountForSuppliersNotDefined';
if ($tabtype[$key] == 'payment_expensereport') $errorstring = 'MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_salary') $errorstring = 'MainAccountForUsersNotDefined';
if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined';
if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
print '<span class="error">'.$langs->trans($errorstring).'</span>';
}
}
@ -1169,7 +1169,7 @@ if (empty($action) || $action == 'view') {
var_dump($tabtype[$key]);
var_dump($tabbq[$key]);*/
//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'))) {
// 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>" . $reflabel . "</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>".$reflabel."</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 "</tr>";
}
}
@ -1199,13 +1199,13 @@ if (empty($action) || $action == 'view') {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
$reflabel.= 'WaitingAccount';
if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
$reflabel .= 'WaitingAccount';
print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
print "<td>".$date."</td>";
print "<td>".$ref."</td>";
// Ledger account
print "<td>";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
@ -1223,10 +1223,10 @@ if (empty($action) || $action == 'view') {
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print "</td>";
print "<td>" . $reflabel . "</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>".$reflabel."</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 "</tr>";
}
}
@ -1287,63 +1287,63 @@ function getSourceDocRef($val, $typerecord)
{
$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 .= " 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");
}
elseif ($typerecord == 'payment_supplier')
{
$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 .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
$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"];
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
}
elseif ($typerecord == 'payment_expensereport')
{
$sqlmid = 'SELECT e.rowid as id, e.ref';
$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 .= " 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";
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
}
elseif ($typerecord == 'payment_salary')
{
$sqlmid = 'SELECT s.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
}
elseif ($typerecord == 'sc')
{
$sqlmid = 'SELECT sc.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
$sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
$sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
$ref = $langs->transnoentitiesnoconv("SocialContribution");
}
elseif ($typerecord == 'payment_vat')
{
$sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
$sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
$sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
$ref = $langs->transnoentitiesnoconv("PaymentVat");
}
elseif ($typerecord == 'payment_donation')
{
$sqlmid = 'SELECT payd.fk_donation as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
$sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
$ref = $langs->transnoentitiesnoconv("Donation");
}
elseif ($typerecord == 'payment_loan')
{
$sqlmid = 'SELECT l.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_loan as l";
$sqlmid .= " WHERE l.rowid=" . $val["paymentloanid"];
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
$sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
$ref = $langs->transnoentitiesnoconv("LoanPayment");
}
elseif ($typerecord == 'payment_various')
{
$sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
$ref = $langs->transnoentitiesnoconv("VariousPayment");
}
// Add warning
@ -1354,18 +1354,18 @@ function getSourceDocRef($val, $typerecord)
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);
if ($resultmid)
{
while ($objmid = $db->fetch_object($resultmid))
{
$ref.=' '.$objmid->ref;
$ref .= ' '.$objmid->ref;
}
}
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;
}

View File

@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true);
$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->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -448,36 +448,36 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// VAT
foreach ($tabtva[$key] as $k => $mt) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// Third party
foreach ($tabttc[$key] as $k => $mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($userstatic->name) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($userstatic->name).'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"';
}
print "\n";
}
@ -508,7 +508,7 @@ if (empty($action) || $action == 'view') {
}
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') {
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) {
print '<tr class="oddeven">';
print "<!-- VAT -->";
print "<td>" . $date . "</td>";
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
print "<td>".$date."</td>";
print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accountg($k);
@ -655,10 +655,10 @@ if (empty($action) || $action == 'view') {
// Subledger account
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 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>";
}
}

View File

@ -301,7 +301,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$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->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
@ -310,7 +310,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$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->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
@ -329,14 +329,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
$errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
$errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@ -344,7 +344,7 @@ if ($action == 'writebookkeeping') {
}
// Product / Service
if (! $errorforline)
if (!$errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
@ -356,13 +356,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$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->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$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->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -381,14 +381,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
$errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
$errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@ -398,10 +398,10 @@ if ($action == 'writebookkeeping') {
// VAT
// var_dump($tabtva);
if (! $errorforline)
if (!$errorforline)
{
$listoftax=array(0, 1, 2);
foreach($listoftax as $numtax)
$listoftax = array(0, 1, 2);
foreach ($listoftax as $numtax)
{
$arrayofvat = $tabtva;
if ($numtax == 1) $arrayofvat = $tablocaltax1;
@ -416,7 +416,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$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->subledger_account = '';
$bookkeeping->subledger_label = '';
@ -425,7 +425,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true);
$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->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -444,14 +444,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
$errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
$errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@ -462,7 +462,7 @@ if ($action == 'writebookkeeping') {
// Counterpart of VAT for VAT NPR
// var_dump($tabother);
if (! $errorforline && is_array($tabother[$key]))
if (!$errorforline && is_array($tabother[$key]))
{
foreach ($tabother[$key] as $k => $mt) {
if ($mt) {
@ -478,7 +478,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$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->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -513,7 +513,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on lines before
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{
$error++;
$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 '<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') {
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) {
print '<tr class="oddeven">';
print "<!-- Thirdparty -->";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
@ -883,9 +883,9 @@ if (empty($action) || $action == 'view') {
}
else print $accountoshow;
print '</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>".$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 "</tr>";
}
@ -896,8 +896,8 @@ if (empty($action) || $action == 'view') {
print '<tr class="oddeven">';
print "<!-- Product -->";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accountg($k);
@ -912,9 +912,9 @@ if (empty($action) || $action == 'view') {
print '</td>';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
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>".$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 "</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 .= " 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 .= " 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 . "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 . "societe as s ON s.rowid = f.fk_soc";
$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."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."societe as s ON s.rowid = f.fk_soc";
$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";
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 . ")";
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.")";
} 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)";
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
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
}
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 .= " ORDER BY f.datef";
@ -312,7 +312,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$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->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$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->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@ -340,14 +340,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
$errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
$errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') {
}
// Product / Service
if (! $errorforline)
if (!$errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
@ -373,7 +373,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$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->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@ -408,10 +408,10 @@ if ($action == 'writebookkeeping') {
}
// VAT
if (! $errorforline)
if (!$errorforline)
{
$listoftax=array(0, 1, 2);
foreach($listoftax as $numtax)
$listoftax = array(0, 1, 2);
foreach ($listoftax as $numtax)
{
$arrayofvat = $tabtva;
if ($numtax == 1) $arrayofvat = $tablocaltax1;
@ -426,7 +426,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$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->subledger_account = '';
$bookkeeping->subledger_label = '';
@ -435,7 +435,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true);
$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->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@ -471,7 +471,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on lines before
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{
$error++;
$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 '<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') {
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 "<!-- Thirdparty -->";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
@ -819,9 +819,9 @@ if (empty($action) || $action == 'view') {
}
else print $accountoshow;
print '</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>".$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 "</tr>";
}
@ -833,8 +833,8 @@ if (empty($action) || $action == 'view') {
print '<tr class="oddeven">';
print "<!-- Product -->";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accountg($k);
@ -849,9 +849,9 @@ if (empty($action) || $action == 'view') {
print '</td>';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
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>".$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 "</tr>";
}

View File

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

View File

@ -462,7 +462,7 @@ if ($result) {
}
} 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)
$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 = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
@ -553,12 +553,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
// 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>';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
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);
if ($objp->product_id > 0)
{
@ -567,7 +567,7 @@ if ($result) {
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
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 '</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';
// 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');
@ -52,19 +52,19 @@ $action = GETPOST('action', 'alpha');
if ($action == 'updateall')
{
$db->begin();
$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);
$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);
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
$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);
$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);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation
if ($conf->facture->enabled)
{
$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);
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
$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);
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)
@ -82,23 +82,23 @@ if ($action == 'updateall')
// Action to update or add a constant
if ($action == 'update' || $action == 'add')
{
$constname=GETPOST('constname', 'alpha');
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
$constname = GETPOST('constname', 'alpha');
$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_LOGIN_NOT_REQUIRED') // Invert choice
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 ($constvalue) $constvalue=0;
else $constvalue=1;
if ($constvalue) $constvalue = 0;
else $constvalue = 1;
}
$consttype=GETPOST('consttype', 'alpha');
$constnote=GETPOST('constnote');
$res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
$consttype = GETPOST('consttype', 'alpha');
$constnote = GETPOST('constnote');
$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');
}
@ -111,7 +111,7 @@ if ($action == 'update' || $action == 'add')
// Action to enable of a submodule of the adherent module
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)
{
print $db->error();
@ -121,7 +121,7 @@ if ($action == 'set')
// Action to disable a submodule of the adherent module
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)
{
print $db->error();
@ -136,12 +136,12 @@ if ($action == 'unset')
$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);
$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');
@ -162,25 +162,25 @@ print "</tr>\n";
// Login/Pass required for members
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";
// Mail required for members
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";
// Send mail information is on by default
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";
// Insert subscription into bank account
print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
$arraychoices=array('0'=>$langs->trans("None"));
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['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice");
$arraychoices = array('0'=>$langs->trans("None"));
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['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
print '<td>';
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')
@ -194,10 +194,10 @@ print "</tr>\n";
if ($conf->facture->enabled)
{
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
if (! empty($conf->banque->enabled))
if (!empty($conf->banque->enabled))
{
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>';
}
else
@ -208,7 +208,7 @@ if ($conf->facture->enabled)
}
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 '<td>';
@ -232,7 +232,7 @@ print '<br>';
/*
* Edit info of model document
*/
$constantes=array(
$constantes = array(
'ADHERENT_CARD_TYPE',
// 'ADHERENT_CARD_BACKGROUND',
'ADHERENT_CARD_HEADER_TEXT',
@ -243,10 +243,10 @@ $constantes=array(
print load_fiche_titre($langs->trans("MembersCards"), '', '');
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__';
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
@ -256,14 +256,14 @@ print '<br>';
/*
* 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"), '', '');
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__';
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext .= '__YEAR__, __MONTH__, __DAY__';
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';
// 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');
$error = 0;
// 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"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'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_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'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_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
@ -68,8 +68,8 @@ $constantes=array(
if ($action == 'updateall')
{
$db->begin();
$res1=$res2=$res3=$res4=$res5=$res6=0;
$res1=dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$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)
{
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
@ -86,19 +86,19 @@ if ($action == 'updateall')
if ($action == 'update' || $action == 'add')
{
$constlineid = GETPOST('rowid', 'int');
$constname=GETPOST('constname', 'alpha');
$constname = GETPOST('constname', 'alpha');
$constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
$consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
$constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
$consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$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');
}
@ -111,7 +111,7 @@ if ($action == 'update' || $action == 'add')
// Action to enable a submodule of the adherent module
if ($action == 'set')
{
$result=dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0)
{
print $db->error();
@ -121,7 +121,7 @@ if ($action == 'set')
// Action to disable a submodule of the adherent module
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)
{
print $db->error();
@ -136,12 +136,12 @@ if ($action == 'unset')
$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);
$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');
@ -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="action" value="updateall">';
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
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';
// Load translation files required by the page
$langs->loadLangs(array("admin","members"));
$langs->loadLangs(array("admin", "members"));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='adherent'; //Must be the $table_element of the class that manage extrafield
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'adherent'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
@ -60,11 +60,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$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);
$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');
@ -105,7 +105,7 @@ if ($action == 'create')
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
if ($action == 'edit' && !empty($attrname))
{
print '<div name="topofform"></div><br>';
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';
// Load translation files required by the page
$langs->loadLangs(array("admin","members"));
$langs->loadLangs(array("admin", "members"));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='adherent_type'; //Must be the $table_element of the class that manage extrafield
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'adherent_type'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
@ -61,13 +61,13 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* 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);
$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');
@ -108,7 +108,7 @@ if ($action == 'create')
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
if ($action == 'edit' && !empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -178,34 +178,34 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
$listofval = array();
$listofval += $adht->liste_array();
$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";
// Amount
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("DefaultAmount");
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";
// Can edit
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("CanEditAmount");
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";
// Jump to an online payment page
print '<tr class="oddeven" id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
print '</td><td class="right">';
$listofval=array();
$listofval['-1']=$langs->trans('No');
$listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
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);
$listofval = array();
$listofval['-1'] = $langs->trans('No');
$listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox';
if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal';
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 "</td></tr>\n";
print '</table>';

View File

@ -149,24 +149,24 @@ if ($object->id > 0)
$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>';
$param='&id='.$id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
$param = '&id='.$id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
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);
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
// TODO Replace this with same code than into list.php
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)
*/
public $error='';
public $error = '';
/**
* @var string[] Error codes (or messages)
@ -70,7 +70,7 @@ abstract class ActionsAdherentCardCommon
else
{*/
$object = new Adherent($this->db);
if (! empty($id)) $object->fetch($id);
if (!empty($id)) $object->fetch($id);
$this->object = $object;
//}
}
@ -91,13 +91,13 @@ abstract class ActionsAdherentCardCommon
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['error']=$this->error;
$this->tpl['errors']=$this->errors;
$this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors;
if ($action == 'create' || $action == 'edit')
{
@ -139,10 +139,10 @@ abstract class ActionsAdherentCardCommon
}
// 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
$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;
@ -157,14 +157,14 @@ abstract class ActionsAdherentCardCommon
else $this->tpl['select_state'] = $countrynotdefined;
// 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);
}
if ($action == 'view' || $action == 'edit' || $action == 'delete')
{
// Emailing
if (! empty($conf->mailing->enabled))
if (!empty($conf->mailing->enabled))
{
$langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
@ -173,8 +173,8 @@ abstract class ActionsAdherentCardCommon
// Dolibarr user
if ($this->object->user_id)
{
$dolibarr_user=new User($this->db);
$result=$dolibarr_user->fetch($this->object->user_id);
$dolibarr_user = new User($this->db);
$result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
}
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['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);
$this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
$img = picto_from_langcode($this->object->country_code);
$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_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['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['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
$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
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.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);
$password=$generated_password;
$generated_password = getRandomPassword(false);
$password = $generated_password;
// Create a form array
$formquestion=array(
$formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
@ -244,35 +244,35 @@ abstract class ActionsAdherentCardCommon
// phpcs:enable
global $langs, $mysoc;
$this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"];
$this->object->old_name = $_POST["old_name"];
$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->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
$this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
$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
if ($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)
{
$obj = $this->db->fetch_object($resql);
$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
{

View File

@ -42,7 +42,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{
$this->db = $db;
$this->dirmodule = $dirmodule;
$this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
@ -56,13 +56,13 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
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 == '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 == '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 == 'create') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
return $out;
}
@ -88,7 +88,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error;
$this->tpl['errors']= $this->errors;
$this->tpl['errors'] = $this->errors;
if ($action == 'view')
{
@ -96,15 +96,15 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$head = member_prepare_head($this->object);
$title = $this->getTitle($action);
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
$this->tpl['showend']=dol_get_fiche_end();
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
$this->tpl['showend'] = dol_get_fiche_end();
$objsoc = new Societe($db);
$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
{

View File

@ -17,7 +17,7 @@
*/
// 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";
exit;
@ -30,9 +30,9 @@ if (empty($conf) || ! is_object($conf))
<?php
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']);

View File

@ -17,7 +17,7 @@
*/
// 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";
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="old_name" value="<?php echo $this->control->tpl['name']; ?>">
<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']; ?>">
<?php } ?>

View File

@ -17,7 +17,7 @@
*/
// 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";
exit;
@ -30,8 +30,8 @@ echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\n";
echo $this->control->tpl['showhead'];
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_delete'])) echo $this->control->tpl['action_delete']; ?>
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']; ?>
<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>';
}
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>';
}

View File

@ -1773,8 +1773,10 @@ else
if ($action != 'editlogin' && $action != 'editthirdparty')
{
// Send
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>';
if (empty($user->socid)) {
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

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/printsheet/modules_labels.php';
$langs->loadLangs(array("members","errors"));
$langs->loadLangs(array("members", "errors"));
// Choice of printing year or current year.
$now = dol_now();
$year=dol_print_date($now, '%Y');
$month=dol_print_date($now, '%m');
$day=dol_print_date($now, '%d');
$foruserid=GETPOST('foruserid', 'alphanohtml');
$foruserlogin=GETPOST('foruserlogin', 'alphanohtml');
$mode=GETPOST('mode', 'aZ09');
$model=GETPOST("model", 'aZ09'); // Doc template to use for business cards
$modellabel=GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
$mesg='';
$year = dol_print_date($now, '%Y');
$month = dol_print_date($now, '%m');
$day = dol_print_date($now, '%d');
$foruserid = GETPOST('foruserid', 'alphanohtml');
$foruserlogin = GETPOST('foruserlogin', 'alphanohtml');
$mode = GETPOST('mode', 'aZ09');
$model = GETPOST("model", 'aZ09'); // Doc template to use for business cards
$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
$mesg = '';
$adherentstatic=new Adherent($db);
$object=new Adherent($db);
$adherentstatic = new Adherent($db);
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels
@ -57,29 +57,29 @@ $extrafields->fetch_name_optionals_label($object->table_element);
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
$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.= " t.libelle as type,";
$sql.= " c.code as country_code, c.label as country";
$sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields
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 : '');
$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";
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.= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
$sql.= " ORDER BY d.rowid ASC";
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 : '');
$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";
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 .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql .= " ORDER BY d.rowid ASC";
dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql);
@ -91,19 +91,19 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
{
$objp = $db->fetch_object($result);
if ($objp->country == '-') $objp->country='';
if ($objp->country == '-') $objp->country = '';
$adherentstatic->id=$objp->rowid;
$adherentstatic->lastname=$objp->lastname;
$adherentstatic->firstname=$objp->firstname;
$adherentstatic->id = $objp->rowid;
$adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname = $objp->firstname;
// 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']))
{
$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))
{
$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
$substitutionarray = array (
$substitutionarray = array(
'__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
@ -139,21 +139,21 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// 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);
$textheader=make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
if (is_numeric($foruserid) || $foruserlogin)
{
$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,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
@ -165,7 +165,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
}
else
{
$arrayofmembers[]=array(
$arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
@ -179,13 +179,13 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// For labels
if ($mode == 'label')
{
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);
$textheader='';
$textfooter='';
$textright='';
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);
$textheader = '';
$textfooter = '';
$textright = '';
$arrayofmembers[]=array('textleft'=>$textleft,
$arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
@ -197,29 +197,29 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
}
// 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')
{
$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')
{
if (! count($arrayofmembers))
if (!count($arrayofmembers))
{
$mesg=$langs->trans("ErrorRecordNotFound");
$mesg = $langs->trans("ErrorRecordNotFound");
}
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)
@ -232,7 +232,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
dol_print_error($db);
}
if (! $mesg)
if (!$mesg)
{
$db->close();
exit;
@ -244,7 +244,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
* View
*/
$form=new Form($db);
$form = new Form($db);
llxHeader('', $langs->trans("MembersCards"));
@ -257,40 +257,40 @@ dol_htmloutput_errors($mesg);
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 '<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="mode" value="card">';
print '<input type="hidden" name="action" value="builddoc">';
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array();
foreach(array_keys($_Avery_Labels) as $codecards)
$arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards)
{
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
}
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 '</form>';
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 '<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="action" value="builddoc">';
print $langs->trans("DescADHERENT_CARD_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array();
foreach(array_keys($_Avery_Labels) as $codecards)
$arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards)
{
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
}
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><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>';
@ -299,18 +299,18 @@ print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
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="action" value="builddoc">';
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
$arrayoflabels=array();
foreach(array_keys($_Avery_Labels) as $codecards)
$arrayoflabels = array();
foreach (array_keys($_Avery_Labels) as $codecards)
{
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
}
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 '</form>';

View File

@ -60,6 +60,9 @@ class Adherent extends CommonObject
*/
public $ismultientitymanaged = 1;
public $picto = 'member';
public $mesgs;
/**
@ -273,7 +276,7 @@ class Adherent extends CommonObject
'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),
'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),
'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),
@ -657,7 +660,7 @@ class Adherent extends CommonObject
$action = 'update';
// Actions on extra fields
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0) {
@ -927,14 +930,11 @@ class Adherent extends CommonObject
// Removed extrafields
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
$result = $this->deleteExtraFields();
if ($result < 0) {
$error++;
$errorflag = -4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}

View File

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

View File

@ -23,8 +23,8 @@
* \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 . '/adherents/class/subscription.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
include_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
/**
@ -61,17 +61,17 @@ class AdherentStats extends Stats
$this->socid = $socid;
$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."adherent as m";
$this->from .= ", ".MAIN_DB_PREFIX."adherent as m";
$this->field='subscription';
$this->field = 'subscription';
$this->where.= " m.statut != 0";
$this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
$this->where .= " m.statut != 0";
$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($this->memberid)
if ($this->memberid)
{
$this->where .= " AND m.rowid = ".$this->memberid;
}
@ -91,12 +91,12 @@ class AdherentStats extends Stats
global $user;
$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";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
$sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByMonth($year, $sql, $format);
}
@ -111,11 +111,11 @@ class AdherentStats extends Stats
global $user;
$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";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByYear($sql);
}
@ -132,12 +132,12 @@ class AdherentStats extends Stats
global $user;
$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";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
$sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getAmountByMonth($year, $sql, $format);
}
@ -153,12 +153,12 @@ class AdherentStats extends Stats
global $user;
$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";
$sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm', 'DESC');
$sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getAverageByMonth($year, $sql);
}
@ -174,11 +174,11 @@ class AdherentStats extends Stats
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.= " FROM ".$this->from;
$sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY year";
$sql.= $this->db->order('year', 'DESC');
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY year";
$sql .= $this->db->order('year', 'DESC');
return $this->_getAllByYear($sql);
}

View File

@ -59,17 +59,17 @@ class Members extends DolibarrApi
*/
public function get($id)
{
if(! DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
if( ! $result ) {
if (!$result) {
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);
}
@ -86,62 +86,71 @@ class Members extends DolibarrApi
* @param int $limit Limit for list
* @param int $page Page number
* @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.
* Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
* @return array Array of member objects
*
* @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;
$obj_ret = array();
if(! DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as t";
$sql.= ' WHERE t.entity IN ('.getEntity('adherent').')';
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
if ($category > 0) {
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
}
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
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
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset);
$sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
$i=0;
$i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$member = new Adherent($this->db);
if($member->fetch($obj->rowid)) {
if ($member->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($member);
}
$i++;
@ -150,7 +159,7 @@ class Members extends DolibarrApi
else {
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');
}
@ -165,14 +174,14 @@ class Members extends DolibarrApi
*/
public function post($request_data = null)
{
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
$member = new Adherent($this->db);
foreach($request_data as $field => $value) {
foreach ($request_data as $field => $value) {
$member->$field = $value;
}
if ($member->create(DolibarrApiAccess::$user) < 0) {
@ -190,21 +199,21 @@ class Members extends DolibarrApi
*/
public function put($id, $request_data = null)
{
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
if( ! $result ) {
if (!$result) {
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);
}
foreach($request_data as $field => $value) {
foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
// Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class Adherent.
@ -245,20 +254,20 @@ class Members extends DolibarrApi
*/
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->adherent->supprimer) {
if (!DolibarrApiAccess::$user->rights->adherent->supprimer) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
if( ! $result ) {
if (!$result) {
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);
}
if (! $member->delete($member->id, DolibarrApiAccess::$user)) {
if (!$member->delete($member->id, DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting member');
}
@ -334,13 +343,13 @@ class Members extends DolibarrApi
{
$obj_ret = array();
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
if( ! $result ) {
if (!$result) {
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 = '')
{
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
if( ! $result ) {
if (!$result) {
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)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}

View File

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

View File

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

View File

@ -35,12 +35,12 @@ class Subscription extends CommonObject
/**
* @var string ID to identify managed object
*/
public $element='subscription';
public $element = 'subscription';
/**
* @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
@ -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
*/
public $picto='payment';
public $picto = 'payment';
/**
* Date creation record (datec)
@ -93,7 +93,7 @@ class Subscription extends CommonObject
*/
public $fk_bank;
public $fields=array(
public $fields = array(
'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),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
@ -133,12 +133,12 @@ class Subscription extends CommonObject
$error = 0;
$now=dol_now();
$now = dol_now();
// Check parameters
if ($this->datef <= $this->dateh)
{
$this->error=$langs->trans("ErrorBadValueForDate");
$this->error = $langs->trans("ErrorBadValueForDate");
return -1;
}
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)";
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
if ($this->fk_type == null) { // If type not defined, we use the type of member
$type=$member->typeid;
$type = $member->typeid;
} else {
$type=$this->fk_type;
$type = $this->fk_type;
}
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.",";
$sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')";
$sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->dateh)."',";
$sql .= " '".$this->db->idate($this->datef)."',";
$sql .= " ".$this->amount.",";
$sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')";
$resql = $this->db->query($sql);
if (! $resql) {
if (!$resql) {
$error++;
$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;
}
if (! $error && ! $notrigger)
if (!$error && !$notrigger)
{
$this->context = array('member'=>$member);
// Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
@ -203,16 +203,16 @@ class Subscription extends CommonObject
*/
public function fetch($rowid)
{
$sql ="SELECT rowid, fk_type, fk_adherent, datec,";
$sql.=" tms,";
$sql.=" dateadh as dateh,";
$sql.=" datef,";
$sql.=" subscription, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."subscription";
$sql.=" WHERE rowid=".$rowid;
$sql = "SELECT rowid, fk_type, fk_adherent, datec,";
$sql .= " tms,";
$sql .= " dateadh as dateh,";
$sql .= " datef,";
$sql .= " subscription, note, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
@ -240,7 +240,7 @@ class Subscription extends CommonObject
}
else
{
$this->error=$this->db->lasterror();
$this->error = $this->db->lasterror();
return -1;
}
}
@ -275,14 +275,14 @@ class Subscription extends CommonObject
if ($resql)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user);
if (! $error && ! $notrigger) {
if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
// 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
// End call triggers
}
@ -290,7 +290,7 @@ class Subscription extends CommonObject
else
{
$error++;
$this->error=$this->db->lasterror();
$this->error = $this->db->lasterror();
}
// Commit or rollback
@ -318,39 +318,39 @@ class Subscription extends CommonObject
if ($this->fk_bank > 0)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank);
$accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank);
}
$this->db->begin();
if (! $error) {
if (! $notrigger) {
if (!$error) {
if (!$notrigger) {
// 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
// End call triggers
}
}
if (! $error)
if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql);
$resql = $this->db->query($sql);
if ($resql)
{
$num=$this->db->affected_rows($resql);
$num = $this->db->affected_rows($resql);
if ($num)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user);
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$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)
{
$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)
{
$this->db->commit();
@ -358,7 +358,7 @@ class Subscription extends CommonObject
}
else
{
$this->error=$accountline->error;
$this->error = $accountline->error;
$this->db->rollback();
return -1;
}
@ -378,7 +378,7 @@ class Subscription extends CommonObject
else
{
$error++;
$this->error=$this->db->lasterror();
$this->error = $this->db->lasterror();
}
}
@ -407,29 +407,29 @@ class Subscription extends CommonObject
{
global $langs;
$result='';
$result = '';
$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;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
}
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>';
$picto='payment';
$picto = 'payment';
$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 != 2) $result.= $this->ref;
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;
$result .= $linkend;
return $result;
@ -471,11 +471,11 @@ class Subscription extends CommonObject
public function info($id)
{
$sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql.= ' WHERE c.rowid = '.$id;
$sql .= ' c.tms as datem';
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql);
$result = $this->db->query($sql);
if ($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';
// Load translation files required by the page
$langs->loadLangs(array("companies","members","other"));
$langs->loadLangs(array("companies", "members", "other"));
$id=GETPOST('id', 'int');
$action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
// Security check
$result=restrictedArea($user, 'adherent', $id);
$result = restrictedArea($user, 'adherent', $id);
// Get parameters
$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 == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page ;
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
$form = new Form($db);
$object=new Adherent($db);
$membert=new AdherentType($db);
$result=$object->fetch($id);
$object = new Adherent($db);
$membert = new AdherentType($db);
$result = $object->fetch($id);
if ($result < 0)
{
dol_print_error($db);
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
*/
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);
$title=$langs->trans("Member") . " - " . $langs->trans("Documents");
$helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
$title = $langs->trans("Member")." - ".$langs->trans("Documents");
$helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
llxHeader("", $title, $helpurl);
if ($id > 0)
{
$result=$membert->fetch($object->typeid);
$result = $membert->fetch($object->typeid);
if ($result > 0)
{
// Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
$totalsize=0;
foreach($filearray as $key => $file)
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file)
{
$totalsize+=$file['size'];
$totalsize += $file['size'];
}
if (! empty($conf->notification->enabled))
if (!empty($conf->notification->enabled))
$langs->load("mails");
$head = member_prepare_head($object);
@ -154,8 +155,8 @@ if ($id > 0)
$modulepart = 'member';
$permission = $user->rights->adherent->creer;
$permtoedit = $user->rights->adherent->creer;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
print "<br><br>";
}
else

View File

@ -27,7 +27,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
// 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();
$now=dol_now();
$now = dol_now();
if (empty($sortorder)) { $sortorder="ASC"; }
if (empty($sortfield)) { $sortfield="d.login"; }
if (! isset($statut))
if (empty($sortorder)) { $sortorder = "ASC"; }
if (empty($sortfield)) { $sortfield = "d.login"; }
if (!isset($statut))
{
$statut = 1;
}
if (! isset($cotis))
if (!isset($cotis))
{
// by default, members must be up to date of subscription
$cotis=1;
$cotis = 1;
}
$sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = ".$statut;
if ($cotis==1)
if ($cotis == 1)
{
$sql .= " AND datefin > '".$db->idate($now)."'";
}
$sql.= $db->order($sortfield, $sortorder);
$sql .= $db->order($sortfield, $sortorder);
//$sql.=$db->plimit($conf->liste_limit, $offset);
$resql = $db->query($sql);
@ -74,7 +74,7 @@ if ($resql)
while ($i < $num)
{
$objp = $db->fetch_object($result);
$htpass=crypt($objp->pass, makesalt());
$htpass = crypt($objp->pass, makesalt());
print $objp->login.":".$htpass."<br>\n";
$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');
$staticmember=new Adherent($db);
$statictype=new AdherentType($db);
$subscriptionstatic=new Subscription($db);
$staticmember = new Adherent($db);
$statictype = new AdherentType($db);
$subscriptionstatic = new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"), '', 'members');
$Adherents=array();
$AdherentsAValider=array();
$MemberUpToDate=array();
$AdherentsResilies=array();
$Adherents = array();
$AdherentsAValider = array();
$MemberUpToDate = array();
$AdherentsResilies = array();
$AdherentType=array();
$AdherentType = array();
// Type of membership
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
$sql.= " d.statut, count(d.rowid) as somme";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
$sql.= " ON t.rowid = d.fk_adherent_type";
$sql.= " AND d.entity IN (".getEntity('adherent').")";
$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
$sql .= " d.statut, count(d.rowid) as somme";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
$sql .= " ON t.rowid = d.fk_adherent_type";
$sql .= " AND d.entity IN (".getEntity('adherent').")";
$sql .= " WHERE t.entity IN (".getEntity('member_type').")";
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql);
@ -81,32 +81,32 @@ if ($result)
{
$objp = $db->fetch_object($result);
$adhtype=new AdherentType($db);
$adhtype->id=$objp->rowid;
$adhtype->subscription=$objp->subscription;
$adhtype->label=$objp->label;
$AdherentType[$objp->rowid]=$adhtype;
$adhtype = new AdherentType($db);
$adhtype->id = $objp->rowid;
$adhtype->subscription = $objp->subscription;
$adhtype->label = $objp->label;
$AdherentType[$objp->rowid] = $adhtype;
if ($objp->statut == -1) { $MemberToValidate[$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 == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; }
if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; }
if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; }
$i++;
}
$db->free($result);
}
$now=dol_now();
$now = dol_now();
// Members up to date list
// 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)
$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.= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
$sql.= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
$sql .= " AND t.rowid = d.fk_adherent_type";
$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql);
@ -191,10 +191,10 @@ if ($conf->use_javascript_ajax)
}
$total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries = array();
$dataseries[] = array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[] = array($langs->trans("MenuMembersUpToDate"), round($SommeC));
$dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
$dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA));
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
@ -220,15 +220,15 @@ if ($conf->use_javascript_ajax)
print '<br>';
// List of subscription by year
$Total=array();
$Number=array();
$tot=0;
$numb=0;
$Total = array();
$Number = array();
$tot = 0;
$numb = 0;
$sql = "SELECT c.subscription, c.dateadh as dateh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " AND d.rowid = c.fk_adherent";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.rowid = c.fk_adherent";
$result = $db->query($sql);
@ -323,26 +323,26 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
$staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname;
if (! empty($obj->fk_soc))
$staticmember->id = $obj->rowid;
$staticmember->lastname = $obj->lastname;
$staticmember->firstname = $obj->firstname;
if (!empty($obj->fk_soc))
{
$staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name;
$staticmember->name = $staticmember->thirdparty->name;
}
else
{
$staticmember->name=$obj->company;
$staticmember->name = $obj->company;
}
$staticmember->ref=$staticmember->getFullName($langs);
$statictype->id=$obj->typeid;
$statictype->label=$obj->label;
$staticmember->ref = $staticmember->getFullName($langs);
$statictype->id = $obj->typeid;
$statictype->label = $obj->label;
print '<td>'.$staticmember->getNomUrl(1, 32).'</td>';
print '<td>'.$statictype->getNomUrl(1, 32).'</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>';
$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';
// 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');
$action = GETPOST('action', 'aZ09');
// Protection
$socid=0;
$socid = 0;
if ($user->socid > 0)
{
$socid = $user->socid;
}
$object = new Adherent($db);
$result=$object->fetch($rowid);
if (! $result)
$result = $object->fetch($rowid);
if (!$result)
{
dol_print_error($db, "Failed to get adherent: ".$object->error);
exit;
@ -57,16 +57,16 @@ if (! $result)
if ($action == 'dolibarr2ldap')
{
$ldap=new Ldap();
$result=$ldap->connect_bind();
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0)
{
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
$olddn=$dn; // We can say that old dn = dn as we force synchro
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info);
$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) {
@ -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>';
// 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 '<td class="valeur">'.$object->pass.'</td>';
@ -142,14 +142,14 @@ dol_fiche_end();
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>\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>';
// Lecture LDAP
$ldap=new Ldap();
$result=$ldap->connect_bind();
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0)
{
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info, 1);
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")";
if (empty($dn))
@ -184,15 +184,15 @@ if ($result > 0)
//print_r($records);
// 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>';
}
else
{
$result=show_ldap_content($records, 0, $records['count'], true);
$result = show_ldap_content($records, 0, $records['count'], true);
}
}
else

View File

@ -106,6 +106,9 @@ $fieldstosearchall = array(
'd.address'=>'Address',
'd.zip'=>'Zip',
'd.town'=>'Town',
'd.phone'=>"Phone",
'd.phone_perso'=>"PhonePerso",
'd.phone_mobile'=>"PhoneMobile",
'd.note_public'=>'NotePublic',
'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="sortfield" value="'.$sortfield.'">';
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_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";
$modelmail = "member";
@ -947,8 +949,6 @@ print "</table>\n";
print "</div>";
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
llxFooter();
$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';
// Load translation files required by the page
$langs->loadLangs(array("companies","members","bills"));
$langs->loadLangs(array("companies", "members", "bills"));
$action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int');
// Security check
$result=restrictedArea($user, 'adherent', $id);
$result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db);
$result=$object->fetch($id);
$result = $object->fetch($id);
if ($result > 0)
{
$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
@ -58,8 +58,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
/*
* View
*/
$title=$langs->trans("Member") . " - " . $langs->trans("Note");
$helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
$title = $langs->trans("Member")." - ".$langs->trans("Note");
$helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
llxHeader("", $title, $helpurl);
$form = new Form($db);
@ -110,8 +110,8 @@ if ($id)
print '</div>';
$cssclass='titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
$cssclass = 'titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@ -29,7 +29,7 @@ $graphwidth = 700;
$mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio);
$mode=GETPOST('mode')?GETPOST('mode'):'';
$mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check
@ -38,57 +38,57 @@ if ($user->socid > 0)
$action = '';
$socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time());
$startyear=$year-2;
$endyear=$year;
$startyear = $year - 2;
$endyear = $year;
// Load translation files required by the page
$langs->loadLangs(array("companies","members"));
$langs->loadLangs(array("companies", "members"));
/*
* View
*/
$memberstatic=new Adherent($db);
$memberstatic = new Adherent($db);
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);
$tab='byproperties';
$tab = 'byproperties';
$data = array();
$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.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY d.morphy";
$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 .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut = 1";
$sql .= " GROUP BY d.morphy";
$foundphy=$foundmor=0;
$foundphy = $foundmor = 0;
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
$resql=$db->query($sql);
$resql = $db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
$obj = $db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++;
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++;
}
@ -106,14 +106,15 @@ dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'use
// Print title
if (! count($data))
if (!count($data))
{
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
}
else
{
print load_fiche_titre($langs->trans("MembersByNature"), '', '');
print $langs->trans("MembersByNature").'<br>';
print '<br>';
}
// Print array
@ -125,8 +126,8 @@ print '<td class="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>';
if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
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/class/dolgraph.class.php';
$graphwidth=DolGraph::getDefaultGraphSizeForStats('width', 700);
$graphwidth = DolGraph::getDefaultGraphSizeForStats('width', 700);
$mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio);
$mode=GETPOST('mode')?GETPOST('mode'):'';
$mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check
@ -39,32 +39,32 @@ if ($user->socid > 0)
$action = '';
$socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time());
$startyear=$year-2;
$endyear=$year;
$startyear = $year - 2;
$endyear = $year;
// Load translation files required by the page
$langs->loadLangs(array("companies","members"));
$langs->loadLangs(array("companies", "members"));
/*
* View
*/
$arrayjs=array('https://www.google.com/jsapi');
if (! empty($conf->dol_use_jmobile)) $arrayjs=array();
$arrayjs = array('https://www.google.com/jsapi');
if (!empty($conf->dol_use_jmobile)) $arrayjs = array();
$title=$langs->trans("Statistics");
if ($mode == 'memberbycountry') $title=$langs->trans("MembersStatisticsByCountries");
if ($mode == 'memberbystate') $title=$langs->trans("MembersStatisticsByState");
if ($mode == 'memberbytown') $title=$langs->trans("MembersStatisticsByTown");
if ($mode == 'memberbyregion') $title=$langs->trans("MembersStatisticsByRegion");
$title = $langs->trans("Statistics");
if ($mode == 'memberbycountry') $title = $langs->trans("MembersStatisticsByCountries");
if ($mode == 'memberbystate') $title = $langs->trans("MembersStatisticsByState");
if ($mode == 'memberbytown') $title = $langs->trans("MembersStatisticsByTown");
if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion");
llxHeader('', $title, '', '', 0, 0, $arrayjs);
print load_fiche_titre($title, $mesg);
print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir);
@ -73,92 +73,92 @@ if ($mode)
// Define sql
if ($mode == 'memberbycountry')
{
$label=$langs->trans("Country");
$tab='statscountry';
$label = $langs->trans("Country");
$tab = 'statscountry';
$data = array();
$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.=" 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.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code";
$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 .= " 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 .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut = 1";
$sql .= " GROUP BY c.label, c.code";
//print $sql;
}
if ($mode == 'memberbystate')
{
$label=$langs->trans("Country");
$label2=$langs->trans("State");
$tab='statsstate';
$label = $langs->trans("Country");
$label2 = $langs->trans("State");
$tab = 'statsstate';
$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.=" 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_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."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, c.nom";
$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 .= " 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_country as co on d.country = co.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut = 1";
$sql .= " GROUP BY co.label, co.code, c.nom";
//print $sql;
}
if ($mode == 'memberbyregion') //
{
$label=$langs->trans("Country");
$label2=$langs->trans("Region"); //département
$tab='statsregion'; //onglet
$label = $langs->trans("Country");
$label2 = $langs->trans("Region"); //département
$tab = 'statsregion'; //onglet
$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.=" 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_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."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, r.nom"; //+
$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 .= " 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_country as co on d.country = co.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut = 1";
$sql .= " GROUP BY co.label, co.code, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown')
{
$label=$langs->trans("Country");
$label2=$langs->trans("Town");
$tab='statstown';
$label = $langs->trans("Country");
$label2 = $langs->trans("Town");
$tab = 'statstown';
$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.=" 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."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code, d.town";
$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 .= " 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 .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut = 1";
$sql .= " GROUP BY c.label, c.code, d.town";
//print $sql;
}
$langsen=new Translate('', $conf);
$langsen = new Translate('', $conf);
$langsen->setDefaultLang('en_US');
$langsen->load("dict");
//print $langsen->trans("Country"."FI");exit;
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
$resql=$db->query($sql);
$resql = $db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
$obj = $db->fetch_object($resql);
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"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("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"))),
'code'=>$obj->code,
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
@ -167,10 +167,10 @@ if ($mode)
}
if ($mode == 'memberbyregion') //+
{
$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"))),
'label2'=>($obj->label2?$obj->label2:$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"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@ -178,9 +178,9 @@ if ($mode)
}
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"))),
'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")),
$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"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@ -188,9 +188,9 @@ if ($mode)
}
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"))),
'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")),
$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"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@ -214,7 +214,7 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title
if ($mode && ! count($data))
if ($mode && !count($data))
{
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
@ -224,7 +224,7 @@ else
if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'<br>';
elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'<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
{
print $langs->trans("MembersStatisticsDesc").'<br>';
@ -234,8 +234,8 @@ else
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>';//+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>';//+
print '<br>'; //+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>'; //+
}
print '<br>';
}
@ -260,16 +260,16 @@ if (count($arrayjs) && $mode == 'memberbycountry')
print "\tdata.addColumn('number', 'Number');\n";
// loop and dump
$i=0;
foreach($data as $val)
$i = 0;
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']);
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.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries
if ($i >= 400){ break; }
if ($i >= 400) { break; }
$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/lib/member.lib.php';
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0;
$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
$userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
// Security check
if ($user->socid > 0)
@ -40,28 +40,28 @@ if ($user->socid > 0)
$action = '';
$socid = $user->socid;
}
$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time());
$startyear=$year-2;
$endyear=$year;
$startyear = $year - 2;
$endyear = $year;
// Load translation files required by the page
$langs->loadLangs(array("companies","members"));
$langs->loadLangs(array("companies", "members"));
/*
* View
*/
$form=new Form($db);
$form = new Form($db);
$title = $langs->trans("SubscriptionsStatistics");
llxHeader('', $title);
print load_fiche_titre($title, '', 'members');
$dir=$conf->adherent->dir_temp;
$dir = $conf->adherent->dir_temp;
dol_mkdir($dir);
@ -79,13 +79,13 @@ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscripti
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (! $mesg)
if (!$mesg)
{
$px1->SetData($data);
$i=$startyear;
$i = $startyear;
while ($i <= $endyear)
{
$legend[]=$i;
$legend[] = $i;
$i++;
}
$px1->SetLegend($legend);
@ -96,7 +96,7 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NbOfSubscriptions"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
$px1->mode='depth';
$px1->mode = 'depth';
$px1->SetTitle($langs->trans("NbOfSubscriptions"));
$px1->draw($filenamenb, $fileurlnb);
@ -112,13 +112,13 @@ $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscr
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (! $mesg)
if (!$mesg)
{
$px2->SetData($data);
$i=$startyear;
$i = $startyear;
while ($i <= $endyear)
{
$legend[]=$i;
$legend[] = $i;
$i++;
}
$px2->SetLegend($legend);
@ -129,7 +129,7 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
$px2->mode='depth';
$px2->mode = 'depth';
$px2->SetTitle($langs->trans("AmountOfSubscriptions"));
$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 '</tr>';
$oldyear=0;
$oldyear = 0;
foreach ($data as $val)
{
$year = $val['year'];
while ($oldyear > $year+1)
while ($oldyear > $year + 1)
{ // If we have empty year
$oldyear--;
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['avg'], 'MT'), 1).'</td>';
print '</tr>';
$oldyear=$year;
$oldyear = $year;
}
print '</table>';

View File

@ -81,33 +81,33 @@ if ($rowid)
$result = $object->fetch($rowid);
// 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
if ($object->user_id)
{
// $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)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer) );
$caneditpassworduser=( (($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password) );
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// 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
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
$hookmanager->initHooks(array('subscription'));
// PDF
$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));
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 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));
$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';
// 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)
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="sortfield" value="'.$sortfield.'">';
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_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";
$modelmail = "subscription";

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* 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
* 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;
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
$newcardbutton = '';
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="action" value="list">';
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_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 = '';
@ -375,13 +377,8 @@ if ($action == 'create')
print '</td></tr>';
// 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);
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '<tbody>';
print "</table>\n";
@ -822,15 +819,6 @@ if ($rowid > 0)
// Other attributes
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>';
dol_fiche_end();

View File

@ -71,21 +71,21 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
$current_lang = $langs->getDefaultLang();
// update of object
if ( $_POST["forcelangprod"] == $current_lang )
if ($_POST["forcelangprod"] == $current_lang)
{
$object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]);
}
else
{
$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"]);
}
// backup into database
if ( $object->setMultiLangs($user) > 0 )
if ($object->setMultiLangs($user) > 0)
{
$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.formcompany.class.php';
$action=GETPOST('action', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
// Load translation files required by the page
$langs->loadLangs(array('admin', 'companies'));
if (! $user->admin) accessforbidden();
if (!$user->admin) accessforbidden();
$error=0;
$error = 0;
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array();
$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 ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|| ($action == 'updateedit') )
if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|| ($action == 'updateedit'))
{
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);
@ -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_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
if ($action != 'updateedit' && ! $error)
if ($action != 'updateedit' && !$error)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
@ -75,7 +75,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
* View
*/
$help_url='';
$help_url = '';
llxHeader('', $langs->trans("CompanyFoundation"), $help_url);
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');
$form=new Form($db);
$formother=new FormOther($db);
$formcompany=new FormCompany($db);
$form = new Form($db);
$formother = new FormOther($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 "<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="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";
// Name
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
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 '<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 '<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
print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n";
@ -139,28 +139,28 @@ print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
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 '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
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 '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
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";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
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";
// Code
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
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
$tmparray = explode('@', $module);
if (! empty($tmparray[1])) {
if (!empty($tmparray[1])) {
$module = $tmparray[1];
}

View File

@ -41,13 +41,13 @@ $extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='actioncomm'; //Must be the $table_element of the class that manage extrafield
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'actioncomm'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
@ -64,15 +64,15 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* 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);
$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');
$head=agenda_prepare_head();
$head = agenda_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), -1, 'action');
@ -109,7 +109,7 @@ if ($action == 'create')
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
if ($action == 'edit' && !empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));

View File

@ -38,14 +38,14 @@ if (!$user->admin) accessforbidden();
$langs->loadLangs(array('agenda', 'admin', 'other'));
$def = array();
$actiontest=GETPOST('test', 'alpha');
$actionsave=GETPOST('save', 'alpha');
$actiontest = GETPOST('test', 'alpha');
$actionsave = GETPOST('save', 'alpha');
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
// 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();
$disableext=GETPOST('AGENDA_DISABLE_EXT', 'alpha');
$res=dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity);
$disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha');
$res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity);
$i=1; $errorsaved=0;
$error=0;
$i = 1; $errorsaved = 0;
$error = 0;
// Save agendas
while ($i <= $MAXAGENDA)
{
$name=trim(GETPOST('AGENDA_EXT_NAME'.$i, 'alpha'));
$src=trim(GETPOST('AGENDA_EXT_SRC'.$i, 'alpha'));
$offsettz=trim(GETPOST('AGENDA_EXT_OFFSETTZ'.$i, 'alpha'));
$color=trim(GETPOST('AGENDA_EXT_COLOR'.$i, 'alpha'));
if ($color=='-1') $color='';
$enabled=trim(GETPOST('AGENDA_EXT_ENABLED'.$i, 'alpha'));
$name = trim(GETPOST('AGENDA_EXT_NAME'.$i, 'alpha'));
$src = trim(GETPOST('AGENDA_EXT_SRC'.$i, 'alpha'));
$offsettz = trim(GETPOST('AGENDA_EXT_OFFSETTZ'.$i, 'alpha'));
$color = trim(GETPOST('AGENDA_EXT_COLOR'.$i, 'alpha'));
if ($color == '-1') $color = '';
$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');
$error++;
@ -81,29 +81,29 @@ if ($actionsave)
}
//print '-name='.$name.'-color='.$color;
$res=dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
$i++;
}
// 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);
if (! $res > 0) $error++;
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;
$res = dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOST('AGENDA_EXT_NB', 'int')), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
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;
}
if (! $error)
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -119,24 +119,24 @@ if ($actionsave)
* View
*/
$form=new Form($db);
$formadmin=new FormAdmin($db);
$formother=new FormOther($db);
$form = new Form($db);
$formadmin = new FormAdmin($db);
$formother = new FormOther($db);
$arrayofjs=array();
$arrayofcss=array();
$arrayofjs = 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);
$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 '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
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');
@ -144,8 +144,8 @@ print '<span class="opacitymedium">'.$langs->trans("AgendaExtSitesDesc")."</span
print "<br>\n";
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
$selectedvalue = $conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue == 1) $selectedvalue = 0; else $selectedvalue = 1;
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 "</tr>";
$i=1;
$i = 1;
while ($i <= $MAXAGENDA)
{
$key=$i;
$name='AGENDA_EXT_NAME'.$key;
$src='AGENDA_EXT_SRC'.$key;
$offsettz='AGENDA_EXT_OFFSETTZ'.$key;
$color='AGENDA_EXT_COLOR'.$key;
$enabled='AGENDA_EXT_ENABLED'.$key;
$key = $i;
$name = 'AGENDA_EXT_NAME'.$key;
$src = 'AGENDA_EXT_SRC'.$key;
$offsettz = 'AGENDA_EXT_OFFSETTZ'.$key;
$color = 'AGENDA_EXT_COLOR'.$key;
$enabled = 'AGENDA_EXT_ENABLED'.$key;
print '<tr class="oddeven">';
// Nb
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb", $key)."</td>";
// 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
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
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)
print '<td class="nowrap right">';
//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 "</tr>";
$i++;

View File

@ -324,7 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
}
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 '<table class="noborder allwidth">'."\n";

View File

@ -30,7 +30,7 @@ if (!$user->admin)
accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array("admin","other","agenda"));
$langs->loadLangs(array("admin", "other", "agenda"));
$action = GETPOST('action', '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))
{
$code=$reg[1];
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
$code = $reg[1];
$value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{
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))
{
$code=$reg[1];
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
@ -83,21 +83,21 @@ if ($action == 'set')
}
elseif ($action == 'specimen') // For orders
{
$modele=GETPOST('module', 'alpha');
$modele = GETPOST('module', 'alpha');
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
$commande->thirdparty=$specimenthirdparty;
$commande->thirdparty = $specimenthirdparty;
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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))
{
$filefound=1;
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
@ -166,21 +166,21 @@ elseif ($action == 'setdoc')
* View
*/
$formactions=new FormActions($db);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
$formactions = new FormActions($db);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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');
$head=agenda_prepare_head();
$head = agenda_prepare_head();
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
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 '<table class="noborder allwidth">'."\n";

View File

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

View File

@ -473,7 +473,7 @@ print '</td>';
print '</tr>';
// 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 $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
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';
// 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)
accessforbidden();
@ -51,13 +51,13 @@ if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_AD
if ($action == 'updateMask')
{
$maskconstchequereceipts=GETPOST('maskconstchequereceipts', 'alpha');
$maskchequereceipts=GETPOST('maskchequereceipts', 'alpha');
$maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'alpha');
$maskchequereceipts = GETPOST('maskchequereceipts', 'alpha');
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');
}
@ -74,13 +74,13 @@ if ($action == 'setmod')
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);
if (! $res > 0) $error++;
if (!$res > 0) $error++;
if (! $error)
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@ -94,12 +94,12 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
* View
*/
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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');
$head = bank_admin_prepare_head(null);
@ -130,25 +130,25 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
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;
$name = substr($file, 4, dol_strlen($file) -16);
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = preg_replace('/\.php$/', '', $file);
// For compatibility
if (! is_file($dir.$filebis))
if (!is_file($dir.$filebis))
{
$filebis = $file."/".$file.".modules.php";
$classname = "mod_chequereceipt_".$file;
}
// Check if there is a filter on country
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);
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
require_once $dir.$filebis;
@ -156,13 +156,13 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db);
// 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->isEnabled())
{
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 $module->info();
@ -171,9 +171,9 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module
print '<td class="nowrap">';
$tmp=$module->getExample();
$tmp = $module->getExample();
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;
print '</td>'."\n";
@ -188,21 +188,21 @@ foreach ($dirmodels as $reldir)
}
print '</td>';
$chequereceipts=new RemiseCheque($db);
$chequereceipts = new RemiseCheque($db);
$chequereceipts->initAsSpecimen();
// Example
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc, $chequereceipts);
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $chequereceipts);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=$langs->trans("NextValue").': ';
$htmltooltip .= $langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>';
$htmltooltip .= $nextval.'<br>';
} 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 (! empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
}
print '</td>';
@ -247,15 +247,15 @@ print '<td class="center" width="60">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
$htmltext .= '</i>';
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>';
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
$variablename = 'BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
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
{
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 '</td><td class="right">';

View File

@ -40,8 +40,8 @@ $action = GETPOST('action', 'aZ09');
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);
$result2=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), '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);
if ($result1 >= 0 && $result2 >= 0)
{
@ -60,10 +60,10 @@ if ($action == 'setvalue' && $user->admin)
$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);
$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 '<span class="opacitymedium">'.$langs->trans("ClickToDialDesc")."</span><br>\n";
@ -90,7 +90,7 @@ print '</td></tr>';
print '<tr class="oddeven"><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 '<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>';
if (! empty($conf->global->CLICKTODIAL_URL))
if (!empty($conf->global->CLICKTODIAL_URL))
{
$user->fetch_clicktodial();
$phonefortest=$mysoc->phone;
if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest');
$phonefortest = $mysoc->phone;
if (GETPOST('phonefortest')) $phonefortest = GETPOST('phonefortest');
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 '<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 '</form>';
$setupcomplete=1;
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('/__PHONEFROM__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete=0;
$setupcomplete = 1;
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('/__PHONEFROM__/', $conf->global->CLICKTODIAL_URL) && empty($user->clicktodial_poste)) $setupcomplete = 0;
if ($setupcomplete)
{

View File

@ -192,7 +192,8 @@ elseif ($action == 'set_ORDER_FREE_TEXT')
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == "setshippableiconinlist") {
}
elseif ($action == "setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$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');
}
}
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
elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
@ -517,7 +537,122 @@ foreach ($dirmodels as $reldir)
}
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

View File

@ -46,13 +46,13 @@ $extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield
$action = GETPOST('action', 'alpha');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
@ -69,11 +69,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject=$langs->transnoentitiesnoconv("Receptions");
$textobject = $langs->transnoentitiesnoconv("Receptions");
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 "<br>\n";
@ -114,7 +114,7 @@ if ($action == 'create')
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
if ($action == 'edit' && !empty($attrname))
{
print "<br>";
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="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";
// Name
@ -429,7 +429,7 @@ print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SO
// Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($mysoc->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n";
@ -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 '</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 {
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 '</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 {
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
}
@ -527,13 +527,13 @@ print '</table>';
// Social networks
print '<br>';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
$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 '<label for="'.$networkkey.'url">'.$langs->trans("SocialNetworks".ucfirst($networkkey)."URL").'</label></td><td>';
$networkconst = 'MAIN_INFO_SOCIETE_'.strtoupper($networkkey).'_URL';
@ -547,7 +547,7 @@ print "</table>";
print '<br>';
// 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>';
$langs->load("companies");
@ -680,7 +680,7 @@ print '</table>';
// Fiscal year start
print '<br>';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
@ -695,7 +695,7 @@ print '<br>';
// Sales taxes (VAT, IRPF, ...)
print load_fiche_titre($langs->trans("TypeOfSaleTaxes"));
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td width="25%">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
print '<td class="right">&nbsp;</td>';
@ -721,7 +721,7 @@ print "</table>";
// Second tax
print '<br>';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent editmode">';
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 class="right">&nbsp;</td>';
@ -758,9 +758,9 @@ if ($mysoc->useLocalTax(1))
} else {
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 {
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
print '<br>';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent editmode">';
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 class="right">&nbsp;</td>';
@ -804,18 +804,18 @@ if ($mysoc->useLocalTax(2))
} else {
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 {
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>";
// Third tax system
// Tax stamp
print '<br>';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent editmode">';
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 class="right">&nbsp;</td>';
@ -823,7 +823,7 @@ print "</tr>\n";
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
print "<tr class=\"oddeven\"><td>";
print '<tr class="oddeven"><td>';
print $langs->trans("UseRevenueStamp");
print "</td>";
print '<td colspan="2">';
@ -832,9 +832,9 @@ if ($mysoc->useRevenueStamp())
} else {
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 {
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');
}
@ -99,9 +99,9 @@ if ($action == 'update')
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 '<br>';

View File

@ -35,7 +35,7 @@ $langs->loadLangs(array('admin', 'sendings', 'deliveries'));
if (!$user->admin)
accessforbidden();
$action=GETPOST('action', 'alpha');
$action = GETPOST('action', 'alpha');
/*
@ -43,7 +43,7 @@ $action=GETPOST('action', 'alpha');
*/
// 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.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
@ -66,7 +66,7 @@ if ($action == 'disable_sending')
// Delivery note
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);
header("Location: confexped.php");
exit;
@ -84,11 +84,11 @@ elseif ($action == 'disable_delivery')
*/
$dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
$form=new Form($db);
$form = new Form($db);
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 '<br>';
$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
$langs->load("admin");
if (! $user->admin)
if (!$user->admin)
accessforbidden();
$rowid=GETPOST('rowid', 'int');
$entity=GETPOST('entity', 'int');
$action=GETPOST('action', 'alpha');
$update=GETPOST('update', 'alpha');
$delete=GETPOST('delete', 'none'); // Do not use alpha here
$debug=GETPOST('debug', 'int');
$consts=GETPOST('const', 'array');
$constname=GETPOST('constname', 'alphanohtml');
$constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here
$constnote=GETPOST('constnote', 'alpha');
$rowid = GETPOST('rowid', 'int');
$entity = GETPOST('entity', 'int');
$action = GETPOST('action', 'alpha');
$update = GETPOST('update', 'alpha');
$delete = GETPOST('delete', 'none'); // Do not use alpha here
$debug = GETPOST('debug', 'int');
$consts = GETPOST('const', 'array');
$constname = GETPOST('constname', 'alphanohtml');
$constvalue = GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here
$constnote = GETPOST('constnote', 'alpha');
// 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');
$sortorder = GETPOST('sortorder', 'alpha');
$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'))
{
$error=0;
$error = 0;
if (empty($constname))
{
@ -76,15 +76,15 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
$error++;
}
if (! $error)
if (!$error)
{
if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0)
{
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action="";
$constname="";
$constvalue="";
$constnote="";
$action = "";
$constname = "";
$constvalue = "";
$constnote = "";
}
else
{
@ -94,12 +94,12 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
}
// Mass update
if (! empty($consts) && $action == 'update')
if (!empty($consts) && $action == 'update')
{
$nbmodified=0;
foreach($consts as $const)
$nbmodified = 0;
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)
{
@ -112,16 +112,16 @@ if (! empty($consts) && $action == 'update')
}
}
if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action='';
$action = '';
}
// Mass delete
if (! empty($consts) && $action == 'delete')
if (!empty($consts) && $action == 'delete')
{
$nbdeleted=0;
foreach($consts as $const)
$nbdeleted = 0;
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)
{
@ -134,7 +134,7 @@ if (! empty($consts) && $action == 'delete')
}
}
if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
$action='';
$action = '';
}
// Delete line from delete picto
@ -157,7 +157,7 @@ if ($action == 'delete')
$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);
// Add logic to show/hide buttons
@ -191,7 +191,7 @@ print "<br>\n";
$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" id="action" name="action" value="">';
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("Comment", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
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("Action", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList("", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print "</tr>\n";
// Line to add new record
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 '<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 '<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>';
// Limit to superadmin
if (! empty($conf->multicompany->enabled) && !$user->entity)
if (!empty($conf->multicompany->enabled) && !$user->entity)
{
print '<td>';
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
@ -243,19 +243,19 @@ print '</tr>';
// Show constants
$sql = "SELECT";
$sql.= " rowid";
$sql.= ", ".$db->decrypt('name')." as name";
$sql.= ", ".$db->decrypt('value')." as value";
$sql.= ", type";
$sql.= ", note";
$sql.= ", tms";
$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
$sql .= " rowid";
$sql .= ", ".$db->decrypt('name')." as name";
$sql .= ", ".$db->decrypt('value')." as value";
$sql .= ", type";
$sql .= ", note";
$sql .= ", tms";
$sql .= ", entity";
$sql .= " FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
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
if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name'));
$sql.= $db->order($sortfield, $sortorder);
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'));
$sql .= $db->order($sortfield, $sortorder);
dol_syslog("Const::listConstant", LOG_DEBUG);
$result = $db->query($sql);
@ -291,7 +291,7 @@ if ($result)
print '</td>';
// Entity limit to superadmin
if (! empty($conf->multicompany->enabled) && !$user->entity)
if (!empty($conf->multicompany->enabled) && !$user->entity)
{
print '<td>';
print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.$obj->entity.'">';
@ -310,7 +310,7 @@ if ($result)
}
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";

View File

@ -32,9 +32,9 @@ global $conf;
if (!$user->admin) accessforbidden();
// 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');
@ -54,7 +54,7 @@ if ($action == 'set')
$error++;
}
if (! $error)
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -73,14 +73,14 @@ if ($action == 'set')
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("DebugBar"));
if (! function_exists('mb_check_encoding'))
if (!function_exists('mb_check_encoding'))
{
$langs->load("errors");
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 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 '</td></tr>';

View File

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

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 (!$allowed) accessforbidden();
$acts =array(); $actl =array();
$acts = array(); $actl = array();
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
@ -77,7 +77,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$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;
}
@ -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[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->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[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled));
$tabcond[23] = true;
@ -1718,7 +1718,7 @@ if ($id)
print "</td>";
// 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>';
// Delete link

View File

@ -17,7 +17,7 @@
*/
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';
}

View File

@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$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))
{
$code=$reg[1];
$code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
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))
{
$code=$reg[1];
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
@ -67,10 +67,10 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
* View
*/
$help_url='';
$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 '<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>';
}
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>';
}

View File

@ -231,7 +231,7 @@ if ($action == 'confirm_collect')
$form = new Form($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);
@ -577,14 +577,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
// support hook for add action
$parameters = array( 'arrayoftypes' => $arrayoftypes ) ;
$parameters = array('arrayoftypes' => $arrayoftypes);
$res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action);
if($res)
if ($res)
$arrayoftypes = $hookmanager->resArray;
else
foreach($hookmanager->resArray as $k=>$desc)
$arrayoftypes[$k]=$desc;
foreach ($hookmanager->resArray as $k=>$desc)
$arrayoftypes[$k] = $desc;
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);
$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"));

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';
if (!$user->admin)
accessforbidden();
if (!$user->admin) {
accessforbidden();
}
// Load translation files required by the page
$langs->loadLangs(array("users", "admin", "other"));
$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);
$eventstolog = $securityevent->eventstolog;
@ -44,6 +56,7 @@ $eventstolog = $securityevent->eventstolog;
/*
* Actions
*/
if ($action == "save")
{
$i = 0;
@ -67,6 +80,12 @@ if ($action == "save")
* 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';
llxHeader('', $langs->trans("Audit"), $wikihelp);
@ -85,9 +104,10 @@ $head = security_prepare_head();
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 "<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";
// Loop on each event type
foreach ($eventstolog as $key => $arr)
@ -96,10 +116,10 @@ foreach ($eventstolog as $key => $arr)
{
print '<tr class="oddeven">';
print '<td>'.$arr['id'].'</td>';
print '<td>';
print '<td class="center">';
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$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";
}
}
@ -109,7 +129,7 @@ dol_fiche_end();
print '<div class="center">';
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</div>";
print '</div>';
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
$langs->loadLangs(array("admin", "sendings", "deliveries", "other"));
if (! $user->admin)
if (!$user->admin)
accessforbidden();
$action=GETPOST('action', 'alpha');
$value=GETPOST('value', 'alpha');
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type='shipping';
$type = 'shipping';
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')
{
$maskconst=GETPOST('maskconstexpedition', 'alpha');
$maskvalue=GETPOST('maskexpedition', 'alpha');
if (! empty($maskconst))
$maskconst = GETPOST('maskconstexpedition', 'alpha');
$maskvalue = GETPOST('maskexpedition', 'alpha');
if (!empty($maskconst))
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (isset($res))
@ -76,7 +76,7 @@ if ($action == 'updateMask')
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);
if ($res <= 0)
{
@ -84,7 +84,7 @@ elseif ($action == 'set_param')
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);
if ($res <= 0)
{
@ -92,7 +92,7 @@ elseif ($action == 'set_param')
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (! $error)
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@ -100,20 +100,20 @@ elseif ($action == 'set_param')
elseif ($action == 'specimen')
{
$modele=GETPOST('module', 'alpha');
$modele = GETPOST('module', 'alpha');
$exp = new Expedition($db);
$exp->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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))
{
$filefound=1;
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
@ -186,13 +186,13 @@ elseif ($action == 'setmodel')
* 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"));
$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 '<br>';
$head = expedition_admin_prepare_head();
@ -223,11 +223,11 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
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';
@ -236,7 +236,7 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
// 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;
print '<tr><td>'.$module->nom."</td>\n";
@ -246,11 +246,11 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module
print '<td class="nowrap">';
$tmp=$module->getExample();
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$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;
print '</td>'."\n";
@ -267,21 +267,21 @@ foreach ($dirmodels as $reldir)
}
print '</td>';
$expedition=new Expedition($db);
$expedition = new Expedition($db);
$expedition->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc, $expedition);
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $expedition);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>';
$htmltooltip .= $nextval.'<br>';
} 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"), '', '');
// Defini tableau def de modele invoice
$type="shipping";
$type = "shipping";
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$type."'";
$sql .= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
@ -346,42 +346,42 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/expedition".$valdir);
if (is_dir($dir))
{
$handle=opendir($dir);
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
while (($file = readdir($handle)) !== false)
{
$filelist[]=$file;
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
$modulequalified = 1;
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 ($modulequalified)
{
print '<tr><td width="100">';
print (empty($module->name)?$name:$module->name);
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
@ -416,18 +416,18 @@ foreach ($dirmodels as $reldir)
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
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>'.$langs->trans("Logo").': '.yn($module->option_logo, 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("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$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("PaymentConditions").': '.yn($module->option_condreg, 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);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -474,15 +474,15 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n";
print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
$htmltext .= '</i>';
print '<tr><td>';
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))
{
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
{
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 "</td></tr>\n";

View File

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

View File

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

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