Merge remote-tracking branch 'uptream/develop' into 7.0-7
# Conflicts: # htdocs/accountancy/admin/export.php # htdocs/accountancy/class/accountancyexport.class.php # htdocs/accountancy/journal/expensereportsjournal.php
This commit is contained in:
commit
1269d98df2
13
.travis.yml
13
.travis.yml
@ -37,6 +37,7 @@ php:
|
|||||||
- '5.6'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
|
- '7.2'
|
||||||
#- hhvm only with dist: trusty
|
#- hhvm only with dist: trusty
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
@ -71,6 +72,8 @@ matrix:
|
|||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: '7.0'
|
- php: '7.0'
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
|
- php: '7.1'
|
||||||
|
env: DB=postgresql
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: nightly
|
- php: nightly
|
||||||
@ -123,7 +126,10 @@ install:
|
|||||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
||||||
composer -n require phpunit/phpunit ^4
|
composer -n require phpunit/phpunit ^4
|
||||||
fi
|
fi
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||||
|
composer -n require phpunit/phpunit ^5
|
||||||
|
fi
|
||||||
|
if [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
composer -n require phpunit/phpunit ^5
|
composer -n require phpunit/phpunit ^5
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
@ -163,7 +169,7 @@ before_script:
|
|||||||
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
echo
|
echo
|
||||||
echo "Enabling Memcached for PHP <= 5.4"
|
echo "Enabling Memcached for PHP <= 5.4"
|
||||||
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
|
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1, 7.2 and nightly!
|
||||||
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
fi
|
fi
|
||||||
phpenv rehash
|
phpenv rehash
|
||||||
@ -237,7 +243,7 @@ before_script:
|
|||||||
echo "Setting up Apache + FPM"
|
echo "Setting up Apache + FPM"
|
||||||
# enable php-fpm
|
# enable php-fpm
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
# Copy the included pool
|
# Copy the included pool
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
||||||
fi
|
fi
|
||||||
@ -332,6 +338,7 @@ script:
|
|||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Unit testing"
|
echo "Unit testing"
|
||||||
|
phpunit --version
|
||||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||||
set -e
|
set -e
|
||||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
|
|||||||
38
ChangeLog
38
ChangeLog
@ -2,6 +2,27 @@
|
|||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
***** ChangeLog for 6.0.4 compared to 6.0.3 *****
|
||||||
|
FIX: #7737
|
||||||
|
FIX: #7751
|
||||||
|
FIX: #7756 Add better error message
|
||||||
|
FIX: #7786
|
||||||
|
FIX: #7806
|
||||||
|
FIX: #7824
|
||||||
|
FIX: add line bad price and ref
|
||||||
|
FIX: A lot of several fix on local taxes and NPR tax
|
||||||
|
FIX: createfromorder
|
||||||
|
FIX: CSS for IE10
|
||||||
|
FIX: external user cannot be set as internal
|
||||||
|
FIX: Filter type on actioncomm with multiselect doesn't work
|
||||||
|
FIX: list of donation not filtered on multicompany
|
||||||
|
FIX: list of module not complete when module mb_strlen not available
|
||||||
|
FIX: Locatax were not propagated when cloning order or proposal
|
||||||
|
FIX: Searching translation should not be case sensitive
|
||||||
|
FIX: Search into language is ok for file into external modules two.
|
||||||
|
FIX: test for filter fk_status
|
||||||
|
FIX: too much users on holiday list
|
||||||
|
FIX: Wrong alias sql
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||||
@ -13,22 +34,31 @@ NEW: complete_head_from_modules() in ldap_prepare_head()
|
|||||||
|
|
||||||
WARNING:
|
WARNING:
|
||||||
|
|
||||||
|
If you enabled (for test) the experimental BlockedLog module before 7.0, you must purge the table llx_blockedlog because
|
||||||
|
way to save data for final version has changed.
|
||||||
|
|
||||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
* The methode "cloture" on contract were renamed into "closeAll".
|
* The methode "cloture" on contract were renamed into "closeAll".
|
||||||
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
* The method "is_erasable" of invoice return a value <= 0 if not erasable (value is meaning) instead of always 0.
|
||||||
|
* The substitution key for reference of objects is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||||
__PROPALREF__, ...)
|
__PROPALREF__, ...)
|
||||||
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to follow naming conventions.
|
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to follow naming conventions.
|
||||||
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
|
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
|
||||||
|
* Removed old deprecated REST API (APIs found into '/root' section of the REST API explorer in Dolibarr v6).
|
||||||
* Some REST API to access setup features, like dictionaries (country, town, extrafields, ...) were moved into a
|
* Some REST API to access setup features, like dictionaries (country, town, extrafields, ...) were moved into a
|
||||||
common API "/setup".
|
common API "/setup".
|
||||||
* The REST API /documents were renamed into /documents/download and /documents/upload.
|
* The REST API /documents were renamed into /documents/download and /documents/upload.
|
||||||
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
|
* Page bank/index.php, bank/bankentries.php and comm/actions/listactions.php were renamed into
|
||||||
follow page naming conventions (so default filter/sort order features can also work).
|
bank/list.php, bank/bankentries_list.php and comm/actions/list.php to follow page naming
|
||||||
|
conventions (so default filter/sort order features can also work for this pages).
|
||||||
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED.
|
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED.
|
||||||
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY.
|
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY.
|
||||||
* The parameter note into method cloture() is added at end of private note (previously in v6, it replaced).
|
* The parameter note into method cloture() is added at end of private note (previously in v6, it replaced).
|
||||||
* The parameter $user is now mandatory for method createFromOrder and createFromPropal.
|
* The parameter $user is now mandatory for method createFromOrder and createFromPropal.
|
||||||
* Removed js library 'fileupload' that was not used by core code.
|
* Removed js library 'fileupload' that was not used by core code.
|
||||||
|
* Jquery plugin tableDnd updated. You now need to use decodeURI on the return value of tableDnDSerialize()
|
||||||
|
and add 'td.' to the beginning of the dragHandle match string.
|
||||||
|
* IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported.
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||||
|
|||||||
@ -43,3 +43,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache
|
|||||||
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
|
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
|
||||||
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
|
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
|
||||||
|
|
||||||
|
DLLMissing=The "Visual C++ Redistributable for Visual Studio 2012" component is missing. Please install the 32-bit version (vcredit_x86.exe) first from https://www.microsoft.com/en-us/download/details.aspx?id=30679 and restart DoliWamp installation/upgrade.
|
||||||
|
ContinueAnyway=Continue anyway (install process may fails without this prerequisite)
|
||||||
|
|||||||
@ -202,10 +202,30 @@ var value: String;
|
|||||||
function InitializeSetup(): Boolean;
|
function InitializeSetup(): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
|
Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
|
||||||
|
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
|
||||||
|
//----------------------------------------------
|
||||||
|
// Test if msvcr110 DLL has been installed
|
||||||
|
//----------------------------------------------
|
||||||
|
|
||||||
|
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
|
||||||
|
begin
|
||||||
|
// TODO - offer to install the component by opening the URL in the default browser, abort installation if user doesn't accept
|
||||||
|
Result := MsgBox(CustomMessage('DLLMissing')+#13#13+CustomMessage('ContinueAnyway'), mbConfirmation, MB_YESNO) = IDYES;
|
||||||
|
|
||||||
|
end;
|
||||||
|
// Pb seems similar with msvcp110.dll
|
||||||
|
//vcredist_x64.exe
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InitializeWizard();
|
procedure InitializeWizard();
|
||||||
begin
|
begin
|
||||||
|
|
||||||
//version des applis, a modifier pour chaque version de WampServer 2
|
//version des applis, a modifier pour chaque version de WampServer 2
|
||||||
apacheVersion := '2.4.9';
|
apacheVersion := '2.4.9';
|
||||||
phpVersion := '5.5.12' ;
|
phpVersion := '5.5.12' ;
|
||||||
@ -217,6 +237,7 @@ begin
|
|||||||
mysqlPort := '3306';
|
mysqlPort := '3306';
|
||||||
newPassword := 'changeme';
|
newPassword := 'changeme';
|
||||||
|
|
||||||
|
|
||||||
firstinstall := true;
|
firstinstall := true;
|
||||||
|
|
||||||
|
|
||||||
@ -344,18 +365,6 @@ begin
|
|||||||
exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||||
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------
|
|
||||||
// Test if msvcr110 DLL has been installed
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
|
|
||||||
begin
|
|
||||||
// TODO - offer to install the component by opening the URL in the default browser, abort installation if user doesn't accept
|
|
||||||
MsgBox('The "Visual C++ Redistributable for Visual Studio 2012" component is missing. Please install the 32-bit version (vcredit_x86.exe) first from http://www.microsoft.com/en-us/download/details.aspx?id=30679 and restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
|
||||||
end;
|
|
||||||
// Pb seems similar with msvcp110.dll
|
|
||||||
//vcredist_x64.exe
|
|
||||||
|
|
||||||
|
|
||||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||||
|
|||||||
@ -535,7 +535,7 @@ a:hover {
|
|||||||
<li><a href="?lang={$langues[$langue]['autreLangueLien1']}">{$langues[$langue]['autreLangue1']}</a>
|
<li><a href="?lang={$langues[$langue]['autreLangueLien1']}">{$langues[$langue]['autreLangue1']}</a>
|
||||||
- <a href="?lang={$langues[$langue]['autreLangueLien2']}">{$langues[$langue]['autreLangue2']}</a></li>
|
- <a href="?lang={$langues[$langue]['autreLangueLien2']}">{$langues[$langue]['autreLangue2']}</a></li>
|
||||||
<br><br>
|
<br><br>
|
||||||
<li>Provided by <a href="http://www.nltechno.com" targer="_blank">NLTechno</a></li>
|
<li>Provided by <a href="https://www.nltechno.com" targer="_blank">NLTechno</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
@ -580,7 +580,7 @@ a:hover {
|
|||||||
|
|
||||||
|
|
||||||
<ul id="foot">
|
<ul id="foot">
|
||||||
<li><a href="http://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp project</a> was built from modified sources of <a href="http://www.wampserver.com">WampServer project</a> from Anaska</li>
|
<li><a href="https://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp project</a> was built from modified sources of <a href="http://www.wampserver.com">WampServer project</a> from Anaska</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -105,7 +105,7 @@ JQUERYFILETREE:
|
|||||||
RESTLER:
|
RESTLER:
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Add 2 lines into function
|
* Add 2 lines into file AutoLoader.php to complete function
|
||||||
private function alias($className, $currentClass)
|
private function alias($className, $currentClass)
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
@ -116,4 +116,29 @@ to get
|
|||||||
if ($className == 'Luracast\Restler\string') return;
|
if ($className == 'Luracast\Restler\string') return;
|
||||||
if ($className == 'Luracast\Restler\mixed') return;
|
if ($className == 'Luracast\Restler\mixed') return;
|
||||||
...
|
...
|
||||||
|
|
||||||
|
Change also file Luracast/Restler/explorer/index.html
|
||||||
|
|
||||||
|
+With swagger 2:
|
||||||
|
|
||||||
|
* Add line into Util.php to complete function
|
||||||
|
|
||||||
|
public static function getShortName($className)
|
||||||
|
{
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (! is_string($className)) return;
|
||||||
|
//var_dump($className);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PARSEDOWN
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fix to avoid fatal error when mb_strlen not available:
|
||||||
|
|
||||||
|
// @CHANGE LDR Fix when mb_strlen is not available
|
||||||
|
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
|
||||||
|
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
|
||||||
|
else $len = strlen($line);
|
||||||
|
$shortage = 4 - $len % 4;
|
||||||
|
|
||||||
@ -7,3 +7,7 @@
|
|||||||
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
||||||
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
||||||
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
||||||
|
#
|
||||||
|
# Example to test a ldap search:
|
||||||
|
# ldapsearch -h hostname -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password
|
||||||
|
|
||||||
|
|||||||
14
dev/resources/iso-normes/accountancy_rules.txt
Normal file
14
dev/resources/iso-normes/accountancy_rules.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
Gestion escompte:
|
||||||
|
|
||||||
|
Sur une facture de 120 € TTC :
|
||||||
|
707xxx 100 € HT
|
||||||
|
44571x 20 € TVA
|
||||||
|
411xxx 120 € TTC
|
||||||
|
|
||||||
|
Le client règle rapidement et on lui accorde un escompte de 3% (120 € * 3% = 3.6 € TTC), on aura donc :
|
||||||
|
665000 3,00 € HT
|
||||||
|
44571x 0,60 € TVA
|
||||||
|
411xxx 3.60 € TVA
|
||||||
|
|
||||||
|
Et ça marche à l’inverse avec un fournisseur sauf que l’on est en 775000 au lieu de 665000 pour escompte obtenus.
|
||||||
@ -11,3 +11,25 @@ Banque Banque 17306 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/
|
|||||||
Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119
|
Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119
|
||||||
Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131
|
Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131
|
||||||
Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131
|
Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Other example
|
||||||
|
JournalCode JournalLib EcritureNum EcritureDate CompteNum CompteLib CompAuxNum CompAuxLib PieceRef PieceDate EcritureLib Debit Credit EcritureLet DateLet ValidDate Montantdevise Idevise
|
||||||
|
FAC Factures clients AB6/FAC/2017/0045 20171120 41110000 Clients - Ventes de biens ou de prestations de services ID 2892 2 Et 3 Dimensions - 20171120 / 1 0 0 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 70710000 Marchandises (ou groupe) A ID 2892 2 Et 3 Dimensions - 20171120 [AX] Activités Annexes 0 0 1 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 70710000 Marchandises (ou groupe) A ID 2892 2 Et 3 Dimensions - 20171120 [AX] Activités Annexes 0 0 1 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 41110000 Clients - Ventes de biens ou de prestations de services ID 2892 2 Et 3 Dimensions - 20171120 / 2 0 0 0 20171120
|
||||||
|
OUV Balance initiale Balance initiale BRED 20171101 51215000 BRED - 20171101 / 6201 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Crédit Coopératif Nation 20171101 51211000 Crédit Coopératif Nation - 20171101 / 1364 20 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA collectée (Taux Intermédiaire) 20171101 44571200 TVA collectée (Taux Intermédiaire) - 20171101 / 0 0 147 4 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA déductible intracommunautaire 20171101 44566200 TVA déductible intracommunautaire - 20171101 / 18 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Capital souscrit - non appelé 20171101 10110000 Capital souscrit - non appelé - 20171101 / 10 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Réserves statutaires ou contractuelles 20171101 10630000 Réserves statutaires ou contractuelles - 20171101 / 0 0 10 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Frais entrepreneurs 20171101 46750000 Frais entrepreneurs - 20171101 / 0 0 100 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Fournissseurs réglés par Coopaname 20171101 40100000 Fournissseurs réglés par Coopaname - 20171101 / 0 0 4123 20 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA sur autres biens et services 20171101 44566000 TVA sur autres biens et services - 20171101 / 507 70 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA en attente à 20% 20171101 44572200 TVA en attente à 20% - 20171101 / 200 0 0 0 20171101
|
||||||
|
|||||||
@ -46,13 +46,20 @@ then
|
|||||||
then
|
then
|
||||||
aaupper="GR"
|
aaupper="GR"
|
||||||
fi
|
fi
|
||||||
|
if [ $bb = "EG" ]
|
||||||
|
then
|
||||||
|
aaupper="SA"
|
||||||
|
fi
|
||||||
|
|
||||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||||
|
|
||||||
|
echo "***** Process language "$aa"_"$bb
|
||||||
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||||
then
|
then
|
||||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||||
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
|
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
|
||||||
then
|
then
|
||||||
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
|
echo "***** Search original into "$reflang
|
||||||
echo $dirshort is an alternative language of $reflang
|
echo $dirshort is an alternative language of $reflang
|
||||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
|
|||||||
BIN
doc/images/dolibarr_screenshot1_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot1_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 KiB |
BIN
doc/images/dolibarr_screenshot4_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot4_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 171 KiB |
BIN
doc/images/dolibarr_screenshot9_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot9_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
@ -229,7 +229,7 @@ if ($resql)
|
|||||||
|
|
||||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
|
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
|
||||||
|
|
||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
@ -258,6 +258,7 @@ if ($resql)
|
|||||||
print "</select>";
|
print "</select>";
|
||||||
print ajax_combobox("chartofaccounts");
|
print ajax_combobox("chartofaccounts");
|
||||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -86,9 +86,11 @@ if ($action == 'delete') {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
llxheader('', $langs->trans('AccountAccounting'));
|
llxheader('', $langs->trans('AccountingCategory'));
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('AccountingCategory'));
|
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans('AccountingCategory'), $linkback);
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
@ -110,7 +112,7 @@ if (! empty($cat_id))
|
|||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||||
}
|
}
|
||||||
print '<tr><td class="tdtop">' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
$arraykeyvalue=array();
|
$arraykeyvalue=array();
|
||||||
|
|||||||
@ -418,18 +418,15 @@ if ($action == 'disable_favorite')
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formadmin=new FormAdmin($db);
|
$formadmin=new FormAdmin($db);
|
||||||
|
|
||||||
llxHeader();
|
llxHeader('', $langs->trans('AccountingCategory'));
|
||||||
|
|
||||||
$titre=$langs->trans($tablib[$id]);
|
$titre=$langs->trans($tablib[$id]);
|
||||||
$linkback='';
|
$linkback='';
|
||||||
$titlepicto='title_setup';
|
$titlepicto='title_setup';
|
||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||||
|
|
||||||
if ($id == 32)
|
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
||||||
{
|
|
||||||
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
@ -658,7 +655,6 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||||
{
|
{
|
||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
if ($id != 25) $valuetoshow.="*";
|
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
@ -807,10 +803,12 @@ if ($id)
|
|||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
// Link to setup the group
|
// Link to setup the group
|
||||||
print '<td>';
|
print '<td class="center">';
|
||||||
if (empty($obj->formula))
|
if (empty($obj->formula))
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">';
|
||||||
|
print $langs->trans("ListOfAccounts");
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,11 +77,6 @@ $model_option = array (
|
|||||||
'label' => 'ACCOUNTING_EXPORT_DATE',
|
'label' => 'ACCOUNTING_EXPORT_DATE',
|
||||||
'param' => '',
|
'param' => '',
|
||||||
),
|
),
|
||||||
//'ACCOUNTING_EXPORT_PIECE',
|
|
||||||
//'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
|
||||||
//'ACCOUNTING_EXPORT_LABEL',
|
|
||||||
//'ACCOUNTING_EXPORT_AMOUNT',
|
|
||||||
//'ACCOUNTING_EXPORT_DEVISE',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -47,16 +47,16 @@ if ($user->societe_id > 0)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we shoul be able to see fiscal year.
|
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we shoul be able to see fiscal year.
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// List of status
|
// List of status
|
||||||
static $tmpstatut2label = array (
|
static $tmpstatut2label = array (
|
||||||
'0' => 'OpenFiscalYear',
|
'0' => 'OpenFiscalYear',
|
||||||
'1' => 'CloseFiscalYear'
|
'1' => 'CloseFiscalYear'
|
||||||
);
|
);
|
||||||
$statut2label = array (
|
$statut2label = array (
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
foreach ( $tmpstatut2label as $key => $val )
|
foreach ( $tmpstatut2label as $key => $val )
|
||||||
$statut2label[$key] = $langs->trans($val);
|
$statut2label[$key] = $langs->trans($val);
|
||||||
@ -100,14 +100,23 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result)
|
||||||
$var = false;
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
if (! empty($user->rights->accounting->fiscalyear))
|
||||||
|
{
|
||||||
|
$addbutton = '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$addbutton = '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
$title = $langs->trans('AccountingPeriods');
|
$title = $langs->trans('AccountingPeriods');
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 1);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
|
||||||
|
|
||||||
// Load attribute_label
|
// Load attribute_label
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -132,8 +141,7 @@ if ($result) {
|
|||||||
print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
|
print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
|
||||||
print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
|
print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var = ! $var;
|
$i++;
|
||||||
$i ++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
||||||
@ -143,19 +151,6 @@ if ($result) {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
// Buttons
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
if (! empty($user->rights->accounting->fiscalyear))
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -66,8 +66,8 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
if (empty($search_date_start))
|
||||||
|
{
|
||||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
$year_start = dol_print_date(dol_now(), '%Y');
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
$year_end = $year_start + 1;
|
$year_end = $year_start + 1;
|
||||||
|
|||||||
@ -434,7 +434,7 @@ if ($action == 'create')
|
|||||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
print $book->doc_date ? dol_print_date($book->doc_date, 'day') : ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -507,7 +507,7 @@ if ($action == 'create')
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("DateCreation") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("DateCreation") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $book->date_creation ? dol_print_date($book->date_creation, 'daytext') : ' ';
|
print $book->date_creation ? dol_print_date($book->date_creation, 'day') : ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -648,7 +648,7 @@ if ($action == 'create')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_debit != $total_credit)
|
if (price2num($total_debit) != price2num($total_credit))
|
||||||
{
|
{
|
||||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
@ -99,9 +100,19 @@ $formother = new FormOther($db);
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
|
if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page))
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
{
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
@ -398,18 +409,14 @@ $listofformat=AccountancyExport::getType();
|
|||||||
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
||||||
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
||||||
else $button.= $langs->trans("ExportList");
|
else $button.= $langs->trans("ExportList");
|
||||||
$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
||||||
$button.= '</a>';
|
$button.= '</a>';
|
||||||
|
|
||||||
|
|
||||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||||
|
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby, '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$addbutton, '', $limit);
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
@ -696,6 +703,12 @@ if ($num > 0)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Replace this with mass action
|
||||||
|
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
||||||
|
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
@ -39,8 +40,22 @@ $page = GETPOST("page");
|
|||||||
$sortorder = GETPOST("sortorder");
|
$sortorder = GETPOST("sortorder");
|
||||||
$sortfield = GETPOST("sortfield");
|
$sortfield = GETPOST("sortfield");
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
if (empty($search_date_start))
|
||||||
|
{
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
}
|
||||||
|
|
||||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +192,7 @@ $num=count($object->lines);
|
|||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
@ -208,8 +223,9 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||||
|
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat.$addbutton,'', $limit);
|
||||||
|
|
||||||
// Reverse sort order
|
// Reverse sort order
|
||||||
if ( preg_match('/^asc/i', $sortorder) )
|
if ( preg_match('/^asc/i', $sortorder) )
|
||||||
@ -217,10 +233,6 @@ if ( preg_match('/^asc/i', $sortorder) )
|
|||||||
else
|
else
|
||||||
$sortorder = "desc";
|
$sortorder = "desc";
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -6,7 +6,10 @@
|
|||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -51,7 +54,7 @@ class AccountancyExport
|
|||||||
public static $EXPORT_TYPE_COGILOG = 8;
|
public static $EXPORT_TYPE_COGILOG = 8;
|
||||||
public static $EXPORT_TYPE_AGIRIS = 9;
|
public static $EXPORT_TYPE_AGIRIS = 9;
|
||||||
public static $EXPORT_TYPE_CONFIGURABLE = 10;
|
public static $EXPORT_TYPE_CONFIGURABLE = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var string[] Error codes (or messages)
|
* @var string[] Error codes (or messages)
|
||||||
@ -398,11 +401,11 @@ class AccountancyExport
|
|||||||
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_operation, 25), 25);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . dol_string_unaccent($data->label_operation), 25), 25);
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||||
$Tab['vide'] = str_repeat(' ', 18);
|
$Tab['vide'] = str_repeat(' ', 18);
|
||||||
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34);
|
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
|
||||||
$Tab['end'] = 'O2003';
|
$Tab['end'] = 'O2003';
|
||||||
|
|
||||||
$Tab['end_line'] = $end_line;
|
$Tab['end_line'] = $end_line;
|
||||||
@ -424,7 +427,9 @@ class AccountancyExport
|
|||||||
|
|
||||||
$end_line ="\r\n";
|
$end_line ="\r\n";
|
||||||
|
|
||||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||||
|
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
|
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
foreach ( $TData as $data ) {
|
foreach ( $TData as $data ) {
|
||||||
$code_compta = $data->numero_compte;
|
$code_compta = $data->numero_compte;
|
||||||
if (! empty($data->subledger_account))
|
if (! empty($data->subledger_account))
|
||||||
@ -435,26 +440,55 @@ class AccountancyExport
|
|||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
||||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||||
$Tab['folio'] = '000';
|
$Tab['folio'] = '000';
|
||||||
$Tab['date_ecriture'] = $date_ecriture;
|
|
||||||
|
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
|
||||||
|
//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
|
||||||
|
//$Tab['date_ecriture'] = $date_ecriture;
|
||||||
|
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||||
$Tab['filler'] = ' ';
|
$Tab['filler'] = ' ';
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 20), 20);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 20), 20);
|
||||||
$Tab['sens'] = $data->sens; // C or D
|
$Tab['sens'] = $data->sens; // C or D
|
||||||
$Tab['signe_montant'] = '+';
|
$Tab['signe_montant'] = '+';
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
|
||||||
|
//elarifr le montant doit etre en centimes sans point decimal !
|
||||||
|
$Tab['montant'] = str_pad(abs($data->montant*100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
|
// $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||||
|
|
||||||
|
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
|
||||||
if (! empty($data->date_echeance))
|
if (! empty($data->date_echeance))
|
||||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
|
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y' ); // elarifr: format must be ddmmyy
|
||||||
else
|
else
|
||||||
$Tab['date_echeance'] = '000000';
|
$Tab['date_echeance'] = '000000';
|
||||||
$Tab['lettrage'] = str_repeat(' ', 5);
|
|
||||||
|
//elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
|
||||||
|
//$Tab['lettrage'] = str_repeat(' ', 5);
|
||||||
|
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||||
|
$Tab['codestat'] = str_repeat(' ', 3);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
||||||
$Tab['filler2'] = str_repeat(' ', 20);
|
|
||||||
|
//elarifr keep correct quadra named field instead of anon filler
|
||||||
|
//$Tab['filler2'] = str_repeat(' ', 20);
|
||||||
|
$Tab['affaire'] = str_repeat(' ', 10);
|
||||||
|
$Tab['quantity1'] = str_repeat(' ', 10);
|
||||||
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
||||||
$Tab['devis'] = str_pad($conf->currency, 3);
|
$Tab['devis'] = str_pad($conf->currency, 3);
|
||||||
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
||||||
$Tab['filler3'] = str_repeat(' ', 3);
|
$Tab['filler3'] = str_repeat(' ', 3);
|
||||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 32), 32);
|
|
||||||
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
//elarifr keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
|
||||||
|
//as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
|
||||||
|
//todo we should filter more than only accent to avoid wrong line size
|
||||||
|
//TODO: remove invoice number doc_ref in libelle,
|
||||||
|
//TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
|
||||||
|
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
|
||||||
|
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
|
||||||
|
$Tab['codetva'] = str_repeat(' ', 2);
|
||||||
|
|
||||||
|
//elarifr we need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
|
||||||
|
//$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||||
|
$Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
|
||||||
$Tab['filler4'] = str_repeat(' ', 73);
|
$Tab['filler4'] = str_repeat(' ', 73);
|
||||||
|
|
||||||
$Tab['end_line'] = $end_line;
|
$Tab['end_line'] = $end_line;
|
||||||
@ -547,9 +581,9 @@ class AccountancyExport
|
|||||||
$tab = array();
|
$tab = array();
|
||||||
// export configurable
|
// export configurable
|
||||||
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
|
$tab[] = $line->piece_num;
|
||||||
$tab[] = $date;
|
$tab[] = $date;
|
||||||
$tab[] = $line->doc_ref;
|
$tab[] = $line->doc_ref;
|
||||||
$tab[] = $line->piece_num;
|
|
||||||
$tab[] = $line->label_operation;
|
$tab[] = $line->label_operation;
|
||||||
$tab[] = length_accountg($line->numero_compte);
|
$tab[] = length_accountg($line->numero_compte);
|
||||||
$tab[] = length_accounta($line->subledger_account);
|
$tab[] = length_accounta($line->subledger_account);
|
||||||
|
|||||||
@ -30,6 +30,7 @@ class AccountingJournal extends CommonObject
|
|||||||
public $table_element='accounting_journal';
|
public $table_element='accounting_journal';
|
||||||
public $fk_element = '';
|
public $fk_element = '';
|
||||||
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
public $picto = 'generic';
|
||||||
|
|
||||||
var $rowid;
|
var $rowid;
|
||||||
|
|
||||||
@ -187,9 +188,6 @@ class AccountingJournal extends CommonObject
|
|||||||
|
|
||||||
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
||||||
|
|
||||||
$picto = 'billr';
|
|
||||||
$label='';
|
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
||||||
if (! empty($this->code))
|
if (! empty($this->code))
|
||||||
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
||||||
@ -223,9 +221,11 @@ class AccountingJournal extends CommonObject
|
|||||||
$label_link = $this->code;
|
$label_link = $this->code;
|
||||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
if ($withlabel) $label_link .= ' - ' . $this->label;
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
$result .= $linkstart;
|
||||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
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.=$linkstart . $label_link . $linkend;
|
if ($withpicto != 2) $result.= $label_link;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,25 +32,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
|||||||
class BookKeeping extends CommonObject
|
class BookKeeping extends CommonObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Error code (or message)
|
* @var string Error code (or message)
|
||||||
* @deprecated
|
|
||||||
*
|
|
||||||
* @see Accountingbookkeeping::errors
|
|
||||||
*/
|
*/
|
||||||
public $error;
|
public $error;
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string[] Error codes (or messages)
|
* @var string[] Error codes (or messages)
|
||||||
*/
|
*/
|
||||||
public $errors = array ();
|
public $errors = array ();
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Id to identify managed objects
|
* @var string Id to identify managed objects
|
||||||
*/
|
*/
|
||||||
public $element = 'accountingbookkeeping';
|
public $element = 'accountingbookkeeping';
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element = 'accounting_bookkeeping';
|
public $table_element = 'accounting_bookkeeping';
|
||||||
@ -58,13 +51,11 @@ class BookKeeping extends CommonObject
|
|||||||
public $entity = 1;
|
public $entity = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var BookKeepingLine[] Lines
|
* @var BookKeepingLine[] Lines
|
||||||
*/
|
*/
|
||||||
public $lines = array ();
|
public $lines = array ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
@ -202,13 +193,18 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$this->piece_num = 0;
|
$this->piece_num = 0;
|
||||||
|
|
||||||
// First check if line not yet already in bookkeeping
|
// First check if line not yet already in bookkeeping.
|
||||||
|
// Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines
|
||||||
|
// with same doc_type, fk_odc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||||
|
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
|
||||||
|
// The page to make journalization make the test on couple doc_type - fk_doc only.
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= " AND fk_doc = " . $this->fk_doc;
|
$sql .= " AND fk_doc = " . $this->fk_doc;
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
//$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||||
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
||||||
|
$sql .= " AND label_operation = '" . $this->db->escape($this->label_operation) . "'";
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file accountancy/class/bookkeeping.class.php
|
* \file accountancy/class/bookkeeping.class.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class for lettering
|
* \brief File of class for lettering
|
||||||
*/
|
*/
|
||||||
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
|
||||||
@ -37,8 +37,9 @@ class lettering extends BookKeeping
|
|||||||
* @param int $socid Thirdparty id
|
* @param int $socid Thirdparty id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function lettrageTiers($socid) {
|
public function lettrageTiers($socid)
|
||||||
$db = $this->db;
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$object = new Societe($this->db);
|
$object = new Societe($this->db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
@ -70,20 +71,20 @@ class lettering extends BookKeeping
|
|||||||
|
|
||||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||||
$sql .= $db->order('bk.doc_date', 'DESC');
|
$sql .= $this->db->order('bk.doc_date', 'DESC');
|
||||||
|
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
//
|
//
|
||||||
$resql = $db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
while ( $obj = $db->fetch_object($resql) ) {
|
while ($obj = $this->db->fetch_object($resql) ) {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
$ids_fact = array();
|
$ids_fact = array();
|
||||||
|
|
||||||
if ($obj->type == 'payment_supplier') {
|
if ($obj->type == 'payment_supplier')
|
||||||
|
{
|
||||||
$sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id';
|
$sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id';
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
@ -103,9 +104,9 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
$sql .= " ) ";
|
$sql .= " ) ";
|
||||||
|
|
||||||
$resql2 = $db->query($sql);
|
$resql2 = $this->db->query($sql);
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
while ( $obj2 = $db->fetch_object($resql2) ) {
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
$ids[$obj2->rowid] = $obj2->rowid;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
$ids_fact[] = $obj2->fact_id;
|
$ids_fact[] = $obj2->fact_id;
|
||||||
}
|
}
|
||||||
@ -130,9 +131,9 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
$sql .= " ) ";
|
$sql .= " ) ";
|
||||||
|
|
||||||
$resql2 = $db->query($sql);
|
$resql2 = $this->db->query($sql);
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
while ( $obj2 = $db->fetch_object($resql2) ) {
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
$ids[$obj2->rowid] = $obj2->rowid;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -161,9 +162,9 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
$sql .= " ) ";
|
$sql .= " ) ";
|
||||||
|
|
||||||
$resql2 = $db->query($sql);
|
$resql2 = $this->db->query($sql);
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
while ( $obj2 = $db->fetch_object($resql2) ) {
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
$ids[$obj2->rowid] = $obj2->rowid;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
$ids_fact[] = $obj2->fact_id;
|
$ids_fact[] = $obj2->fact_id;
|
||||||
}
|
}
|
||||||
@ -188,9 +189,9 @@ class lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
$sql .= " ) ";
|
$sql .= " ) ";
|
||||||
|
|
||||||
$resql2 = $db->query($sql);
|
$resql2 = $this->db->query($sql);
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
while ( $obj2 = $db->fetch_object($resql2) ) {
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
$ids[$obj2->rowid] = $obj2->rowid;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -220,10 +221,12 @@ class lettering extends BookKeeping
|
|||||||
*
|
*
|
||||||
* @param array $ids ids array
|
* @param array $ids ids array
|
||||||
* @param boolean $notrigger no trigger
|
* @param boolean $notrigger no trigger
|
||||||
* @return number
|
* @return number
|
||||||
*/
|
*/
|
||||||
public function updateLettrage($ids = array(), $notrigger = false) {
|
public function updateLettrage($ids = array(), $notrigger = false)
|
||||||
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
$lettre = 'AAA';
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
@ -235,11 +238,10 @@ class lettering extends BookKeeping
|
|||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||||
if (! empty($obj->lettering_code))
|
if (! empty($obj->lettering_code))
|
||||||
$lettre ++;
|
$lettre++;
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error' . $this->db->lasterror();
|
$this->errors[] = 'Error' . $this->db->lasterror();
|
||||||
;
|
$error++;
|
||||||
$error ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
@ -249,29 +251,31 @@ class lettering extends BookKeeping
|
|||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
||||||
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
|
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
|
||||||
$error ++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
|
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
|
||||||
;
|
$error++;
|
||||||
$error ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
if (! $error)
|
||||||
$sql .= " lettering_code='" . $lettre . "'";
|
{
|
||||||
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||||
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
$sql .= " lettering_code='" . $lettre . "'";
|
||||||
$this->db->begin();
|
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
||||||
|
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error++;
|
||||||
$this->errors[] = "Error " . $this->db->lasterror();
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
|
|||||||
@ -33,6 +33,9 @@ $langs->load("bills");
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -40,12 +43,15 @@ $id = GETPOST('id');
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
@ -59,6 +65,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -109,6 +120,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -341,7 +341,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||||
|
|||||||
@ -365,7 +365,7 @@ if ($result) {
|
|||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')).'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -99,6 +99,8 @@ $accounting = new AccountingAccount($db);
|
|||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -140,6 +142,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
@ -167,7 +170,7 @@ if ($massaction == 'ventil') {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '');
|
$accountventilated->fetch($monCompte, '');
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
@ -197,23 +200,30 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("Ventilation"));
|
llxHeader('', $langs->trans("Ventilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Customer Invoice lines
|
// Customer Invoice lines
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
$sql = "SELECT f.rowid as facid, f.facnumber, f.datef, f.type as ftype,";
|
||||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " AND product_type <= 2";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
$sql.= " AND product_type <= 2";
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -255,7 +265,7 @@ else if ($search_year > 0)
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . 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 f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
@ -276,7 +286,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php", LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
@ -302,8 +312,8 @@ if ($result) {
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
@ -319,6 +329,12 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -457,12 +473,14 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
@ -474,5 +492,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -38,6 +38,9 @@ $langs->load("accountancy");
|
|||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -45,12 +48,15 @@ $id = GETPOST('id');
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||||
@ -64,6 +70,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -111,6 +122,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -310,7 +310,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
|
|||||||
@ -328,7 +328,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td>' . $codeCompta . '</td>';
|
print '<td>' . $codeCompta . '</td>';
|
||||||
|
|
||||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')). '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
|
|
||||||
|
|||||||
@ -92,6 +92,8 @@ if (! $user->rights->accounting->bind->write)
|
|||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -182,18 +184,24 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
$sql.= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
$sql.= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||||
$sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
$sql .= natural_search("er.ref",$search_expensereport);
|
$sql .= natural_search("er.ref",$search_expensereport);
|
||||||
@ -266,8 +274,8 @@ if ($result) {
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
|
|
||||||
@ -284,6 +292,12 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -380,11 +394,11 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -399,5 +413,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -118,10 +119,15 @@ $sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
|||||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
|
{
|
||||||
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
{
|
||||||
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||||
|
}
|
||||||
$sql .= " ORDER BY b.datev";
|
$sql .= " ORDER BY b.datev";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -401,6 +407,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Introduce a protection. Total of tabtp must be total of tabbq
|
// Introduce a protection. Total of tabtp must be total of tabbq
|
||||||
@ -459,6 +468,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -565,6 +577,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -584,6 +599,13 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -626,7 +648,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -674,7 +696,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
@ -686,7 +708,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,7 +717,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
if (is_array($tabtp[$key])) {
|
if (is_array($tabtp[$key])) {
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
@ -712,13 +735,14 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
@ -730,7 +754,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -769,15 +794,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
|
|
||||||
// Test that setup is complete
|
// Test that setup is complete
|
||||||
$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
||||||
$resql=$db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj=$db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($obj->nb > 0)
|
if ($obj->nb > 0)
|
||||||
{
|
{
|
||||||
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
@ -793,8 +818,9 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
|
||||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
@ -1004,141 +1030,88 @@ function getSourceDocRef($val, $typerecord)
|
|||||||
|
|
||||||
// Defined the docref into $ref (We start with $val['ref'] by default and we complete according to other data)
|
// Defined the docref into $ref (We start with $val['ref'] by default and we complete according to other data)
|
||||||
// WE MUST HAVE SAME REF FOR ALL LINES WE WILL RECORD INTO THE BOOKKEEPING
|
// WE MUST HAVE SAME REF FOR ALL LINES WE WILL RECORD INTO THE BOOKKEEPING
|
||||||
$reflabel = $val['ref'];
|
$ref = $val['ref'];
|
||||||
if ($reflabel == '(SupplierInvoicePayment)' || $reflabel == '(SupplierInvoicePaymentBack)') {
|
if ($ref == '(SupplierInvoicePayment)' || $ref == '(SupplierInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Supplier');
|
$ref = $langs->trans('Supplier');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(CustomerInvoicePayment)' || $reflabel == '(CustomerInvoicePaymentBack)') {
|
if ($ref == '(CustomerInvoicePayment)' || $ref == '(CustomerInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Customer');
|
$ref = $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SocialContributionPayment)') {
|
if ($ref == '(SocialContributionPayment)') {
|
||||||
$reflabel = $langs->trans('SocialContribution');
|
$ref = $langs->trans('SocialContribution');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(DonationPayment)') {
|
if ($ref == '(DonationPayment)') {
|
||||||
$reflabel = $langs->trans('Donation');
|
$ref = $langs->trans('Donation');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SubscriptionPayment)') {
|
if ($ref == '(SubscriptionPayment)') {
|
||||||
$reflabel = $langs->trans('Subscription');
|
$ref = $langs->trans('Subscription');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(ExpenseReportPayment)') {
|
if ($ref == '(ExpenseReportPayment)') {
|
||||||
$reflabel = $langs->trans('Employee');
|
$ref = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(payment_salary)') {
|
if ($ref == '(payment_salary)') {
|
||||||
$reflabel = $langs->trans('Employee');
|
$ref = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
$ref=$reflabel;
|
|
||||||
|
$sqlmid = '';
|
||||||
if ($typerecord == 'payment')
|
if ($typerecord == 'payment')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
||||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("Invoice");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("Invoice");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_supplier')
|
elseif ($typerecord == 'payment_supplier')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("SupplierInvoice");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("SupplierInvoice");
|
|
||||||
while($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_expensereport')
|
elseif ($typerecord == 'payment_expensereport')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
||||||
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("ExpenseReport");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("ExpenseReport");
|
|
||||||
while($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_salary')
|
elseif ($typerecord == 'payment_salary')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT s.rowid as ref';
|
$sqlmid = 'SELECT s.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
||||||
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("SalaryPayment");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("SalaryPayment");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_vat')
|
elseif ($typerecord == 'payment_vat')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
||||||
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("PaymentVat");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("PaymentVat");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_donation')
|
elseif ($typerecord == 'payment_donation')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payd.fk_donation as ref';
|
$sqlmid = 'SELECT payd.fk_donation as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
||||||
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("Donation").' ';
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("Donation").' ';
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_various')
|
elseif ($typerecord == 'payment_various')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
||||||
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("VariousPayment");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("VariousPayment");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
return $ref;
|
return $ref;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,10 +101,15 @@ $sql .= " AND erd.fk_code_ventilation > 0";
|
|||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
|
{
|
||||||
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
{
|
||||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
|
}
|
||||||
$sql .= " ORDER BY er.date_debut";
|
$sql .= " ORDER BY er.date_debut";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||||
@ -183,6 +188,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
@ -209,6 +217,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -255,6 +266,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -307,6 +321,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -327,6 +344,13 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -343,6 +367,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $taber;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -367,7 +393,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -502,7 +528,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -518,7 +544,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
}
|
}
|
||||||
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -56,9 +56,18 @@ $now = dol_now();
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
$hookmanager->initHooks(array('purchasesjournal'));
|
||||||
|
$parameters=array();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Views
|
||||||
|
*/
|
||||||
|
|
||||||
// Get informations of journal
|
// Get informations of journal
|
||||||
$accountingjournalstatic = new AccountingJournal($db);
|
$accountingjournalstatic = new AccountingJournal($db);
|
||||||
@ -106,10 +115,15 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
|
}
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||||
@ -123,6 +137,7 @@ if ($result) {
|
|||||||
$tablocaltax1 = array ();
|
$tablocaltax1 = array ();
|
||||||
$tablocaltax2 = array ();
|
$tablocaltax2 = array ();
|
||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
$tabother = array();
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
@ -147,6 +162,9 @@ if ($result) {
|
|||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_counterpart_tva_npr = (! empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined';
|
||||||
|
|
||||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
@ -154,6 +172,9 @@ if ($result) {
|
|||||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$line = new SupplierInvoiceLine($db);
|
||||||
|
$line->fetch($obj->fdid);
|
||||||
|
|
||||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||||
@ -174,6 +195,10 @@ if ($result) {
|
|||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
if (! empty($line->tva_npr)) // Add an entry for counterpart
|
||||||
|
{
|
||||||
|
$tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva;
|
||||||
|
}
|
||||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -181,9 +206,9 @@ if ($result) {
|
|||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
'code_fournisseur' => $obj->code_fournisseur,
|
'code_fournisseur' => $obj->code_fournisseur,
|
||||||
'code_compta_fournisseur' => $compta_soc
|
'code_compta_fournisseur' => $compta_soc
|
||||||
);
|
);
|
||||||
|
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -195,8 +220,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
@ -242,6 +271,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -290,6 +322,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -322,6 +357,56 @@ if ($action == 'writebookkeeping') {
|
|||||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
|
$bookkeeping = new BookKeeping($db);
|
||||||
|
$bookkeeping->doc_date = $val["date"];
|
||||||
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
|
$bookkeeping->date_create = $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->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $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;
|
||||||
|
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||||
|
$bookkeeping->code_journal = $journal;
|
||||||
|
$bookkeeping->journal_label = $journal_label;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
|
$result = $bookkeeping->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counterpart of VAT for VAT NPR
|
||||||
|
// var_dump($tabother);
|
||||||
|
if (! $errorforline)
|
||||||
|
{
|
||||||
|
foreach ( $tabother[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
@ -335,7 +420,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' NPR';
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -344,6 +429,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -362,6 +450,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -380,6 +474,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $tabfac;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -404,7 +500,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -502,6 +598,25 @@ if ($action == 'exportcsv') {
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VAT counterpart for NPR
|
||||||
|
foreach ( $tabother[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal . '"' ;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,7 +638,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -535,13 +650,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
@ -668,30 +784,59 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- VAT --></td>";
|
print "<td><!-- VAT --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
// Account
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'.'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>";
|
||||||
|
print $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
|
print "</td>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
// Subledger account
|
|
||||||
print "<td>";
|
|
||||||
print '</td>';
|
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
|
||||||
print "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VAT counterpart for NPR
|
||||||
|
foreach ( $tabother[$key] as $k => $mt ) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- VAT counterpart NPR --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accountg($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'.'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT") . " NPR (counterpart)</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -111,10 +111,15 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
$sql .= " AND fd.product_type IN (0,1)";
|
$sql .= " AND fd.product_type IN (0,1)";
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
|
}
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||||
@ -161,9 +166,10 @@ if ($result) {
|
|||||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Situation invoices handling
|
|
||||||
$line = new FactureLigne($db);
|
$line = new FactureLigne($db);
|
||||||
$line->fetch($obj->fdid);
|
$line->fetch($obj->fdid);
|
||||||
|
|
||||||
|
// Situation invoices handling
|
||||||
$prev_progress = $line->get_prev_progress($obj->fdid);
|
$prev_progress = $line->get_prev_progress($obj->fdid);
|
||||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||||
// Avoid divide by 0
|
// Avoid divide by 0
|
||||||
@ -193,7 +199,7 @@ if ($result) {
|
|||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
if (empty($line->tva_npr)) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -218,6 +224,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
@ -260,6 +269,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -308,6 +320,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -343,7 +358,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
@ -362,6 +377,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -382,6 +400,13 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -399,6 +424,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $tabfac;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -423,7 +450,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -542,7 +569,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -554,13 +581,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
@ -691,7 +719,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|||||||
@ -37,6 +37,9 @@ $langs->load("bills");
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -49,8 +52,10 @@ if ($user->societe_id > 0)
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
@ -64,6 +69,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -111,6 +121,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -309,7 +309,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
|
|||||||
@ -368,13 +368,13 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="left">';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
print '<td align="right">' . $objp->country .'</td>';
|
print '<td>' . $objp->country .'</td>';
|
||||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -100,6 +100,8 @@ $accounting = new AccountingAccount($db);
|
|||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -117,39 +119,40 @@ if (empty($reshook))
|
|||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
$search_day = '';
|
$search_day = '';
|
||||||
$search_month = '';
|
$search_month = '';
|
||||||
$search_year = '';
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='AccountingAccount';
|
$objectclass='AccountingAccount';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permtoread = $user->rights->accounting->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permtodelete = $user->rights->accounting->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->accounting->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
$msg.='<div class="detail">';
|
$msg.='<div class="detail">';
|
||||||
$mesCodesVentilChoisis = $codeventil;
|
|
||||||
$cpt = 0;
|
$cpt = 0;
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$ko=0;
|
$ko=0;
|
||||||
|
|
||||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
foreach ($mesCasesCochees as $maLigneCochee) {
|
||||||
$maLigneCourante = explode("_", $maLigneCochee);
|
$maLigneCourante = explode("_", $maLigneCochee);
|
||||||
$monId = $maLigneCourante[0];
|
$monId = $maLigneCourante[0];
|
||||||
$monCompte = GETPOST('codeventil'.$monId);
|
$monCompte = GETPOST('codeventil'.$monId);
|
||||||
@ -198,9 +201,17 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Supplier Invoice Lines
|
// Supplier Invoice Lines
|
||||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
$sql.= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
@ -209,12 +220,9 @@ $sql.=$hookmanager->resPrint;
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND product_type <= 2";
|
$sql.= " AND product_type <= 2";
|
||||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN
|
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -253,6 +261,11 @@ else if ($search_year > 0)
|
|||||||
{
|
{
|
||||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
@ -298,8 +311,8 @@ if ($result) {
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
@ -315,13 +328,18 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
|
||||||
|
|
||||||
// We add search filter
|
// We add search filter
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -440,7 +458,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->price);
|
print price($objp->total_ht);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
@ -462,15 +480,15 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Colonne choix ligne a ventiler
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,5 +500,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -168,7 +168,7 @@ if ($object->id > 0)
|
|||||||
$filters=array();
|
$filters=array();
|
||||||
$filters['search_agenda_label']=$search_agenda_label;
|
$filters['search_agenda_label']=$search_agenda_label;
|
||||||
|
|
||||||
// TODO Replace this with same code than into listactions.php
|
// TODO Replace this with same code than into list.php
|
||||||
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1211,15 +1211,6 @@ else
|
|||||||
print "</td></tr>";
|
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) && ! empty($extrafields->attribute_label))
|
|
||||||
{
|
|
||||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Third party Dolibarr
|
// Third party Dolibarr
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
{
|
{
|
||||||
@ -1246,6 +1237,15 @@ else
|
|||||||
else print $langs->trans("NoDolibarrAccess");
|
else print $langs->trans("NoDolibarrAccess");
|
||||||
print '</td></tr>';
|
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) && ! empty($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -1487,55 +1487,29 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
// Date end subscription
|
||||||
|
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||||
print '</div>';
|
if ($object->datefin)
|
||||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
|
||||||
print '<table class="border tableforfield" width="100%">';
|
|
||||||
|
|
||||||
// Birthday
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
|
|
||||||
|
|
||||||
// Public
|
|
||||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
|
||||||
|
|
||||||
// Categories
|
|
||||||
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans("Categories") . '</td>';
|
print dol_print_date($object->datefin,'day');
|
||||||
print '<td colspan="2">';
|
if ($object->hasDelay()) {
|
||||||
print $form->showCategories($object->id, 'member', 1);
|
print " ".img_warning($langs->trans("Late"));
|
||||||
print '</td></tr>';
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Other attributes
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
if (! $adht->subscription)
|
||||||
|
{
|
||||||
// Date end subscription
|
print $langs->trans("SubscriptionNotRecorded");
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
if ($object->datefin)
|
}
|
||||||
{
|
else
|
||||||
print dol_print_date($object->datefin,'day');
|
{
|
||||||
if ($object->hasDelay()) {
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
print " ".img_warning($langs->trans("Late"));
|
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
print '</td></tr>';
|
||||||
{
|
|
||||||
if (! $adht->subscription)
|
|
||||||
{
|
|
||||||
print $langs->trans("SubscriptionNotRecorded");
|
|
||||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
|
||||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Third party Dolibarr
|
// Third party Dolibarr
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
@ -1607,6 +1581,32 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
|
// Birthday
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
|
||||||
|
|
||||||
|
// Public
|
||||||
|
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||||
|
|
||||||
|
// Categories
|
||||||
|
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->trans("Categories") . '</td>';
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print $form->showCategories($object->id, 'member', 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div></div></div>\n";
|
print "</div></div></div>\n";
|
||||||
|
|||||||
@ -269,7 +269,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
{
|
{
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||||
}
|
}
|
||||||
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -285,7 +286,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
{
|
{
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||||
}
|
}
|
||||||
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -302,7 +304,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
{
|
{
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||||
}
|
}
|
||||||
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -1969,7 +1969,7 @@ class Adherent extends CommonObject
|
|||||||
$this->fullname=$this->getFullName($langs);
|
$this->fullname=$this->getFullName($langs);
|
||||||
|
|
||||||
// For avoid ldap error when firstname and lastname are empty
|
// For avoid ldap error when firstname and lastname are empty
|
||||||
if ($this->morphy == 'mor' && empty($this->fullname)) {
|
if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) {
|
||||||
$this->fullname = $this->societe;
|
$this->fullname = $this->societe;
|
||||||
$this->lastname = $this->societe;
|
$this->lastname = $this->societe;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -388,23 +388,24 @@ class AdherentType extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
* @param int $maxlen length max label
|
* @param int $maxlen length max label
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$maxlen=0)
|
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowTypeCard",$this->label);
|
$label=$langs->trans("ShowTypeCard",$this->label);
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='group';
|
$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.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
|
||||||
$result.=$link.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,9 +79,10 @@ class AdherentStats extends Stats
|
|||||||
* Return the number of proposition by month for a given year
|
* Return the number of proposition by month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
|
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||||
* @return array Array of nb each month
|
* @return array Array of nb each month
|
||||||
*/
|
*/
|
||||||
function getNbByMonth($year)
|
function getNbByMonth($year, $format=0)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ class AdherentStats extends Stats
|
|||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
|
|
||||||
return $this->_getNbByMonth($year, $sql);
|
return $this->_getNbByMonth($year, $sql, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,12 +117,13 @@ class AdherentStats extends Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of subscriptions by month for a given year
|
* Return the number of subscriptions by month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
|
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||||
* @return array Array of amount each month
|
* @return array Array of amount each month
|
||||||
*/
|
*/
|
||||||
function getAmountByMonth($year)
|
function getAmountByMonth($year, $format=0)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ class AdherentStats extends Stats
|
|||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
|
|
||||||
return $this->_getAmountByMonth($year, $sql);
|
return $this->_getAmountByMonth($year, $sql, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -226,9 +226,13 @@ class Members extends DolibarrApi
|
|||||||
// If there is no error, update() returns the number of affected rows
|
// If there is no error, update() returns the number of affected rows
|
||||||
// so if the update is a no op, the return value is zero.
|
// so if the update is a no op, the return value is zero.
|
||||||
if($member->update(DolibarrApiAccess::$user) >= 0)
|
if($member->update(DolibarrApiAccess::$user) >= 0)
|
||||||
|
{
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $this->task->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,6 +299,17 @@ class Members extends DolibarrApi
|
|||||||
|
|
||||||
// Remove the subscriptions because they are handled as a subresource.
|
// Remove the subscriptions because they are handled as a subresource.
|
||||||
unset($object->subscriptions);
|
unset($object->subscriptions);
|
||||||
|
unset($object->fk_incoterms);
|
||||||
|
unset($object->libelle_incoterms);
|
||||||
|
unset($object->location_incoterms);
|
||||||
|
unset($object->fk_delivery_address);
|
||||||
|
unset($object->shipping_method_id);
|
||||||
|
|
||||||
|
unset($object->total_ht);
|
||||||
|
unset($object->total_ttc);
|
||||||
|
unset($object->total_tva);
|
||||||
|
unset($object->total_localtax1);
|
||||||
|
unset($object->total_localtax2);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,9 +204,13 @@ class MembersTypes extends DolibarrApi
|
|||||||
// If there is no error, update() returns the number of affected rows
|
// If there is no error, update() returns the number of affected rows
|
||||||
// so if the update is a no op, the return value is zero.
|
// so if the update is a no op, the return value is zero.
|
||||||
if ($membertype->update(DolibarrApiAccess::$user) >= 0)
|
if ($membertype->update(DolibarrApiAccess::$user) >= 0)
|
||||||
|
{
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $this->task->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -193,9 +193,13 @@ class Subscriptions extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($subscription->update(DolibarrApiAccess::$user) > 0)
|
if ($subscription->update(DolibarrApiAccess::$user) > 0)
|
||||||
|
{
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $this->task->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -22,6 +22,8 @@
|
|||||||
* \brief File of class to manage subscriptions of foundation members
|
* \brief File of class to manage subscriptions of foundation members
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//namespace DolibarrMember;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
|
|
||||||
@ -170,6 +172,7 @@ class Subscription extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
$member=new Adherent($this->db);
|
$member=new Adherent($this->db);
|
||||||
$result=$member->fetch($this->fk_adherent);
|
$result=$member->fetch($this->fk_adherent);
|
||||||
$result=$member->update_end_date($user);
|
$result=$member->update_end_date($user);
|
||||||
@ -256,23 +259,26 @@ class Subscription extends CommonObject
|
|||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0)
|
function getNomUrl($withpicto=0, $notooltip=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$picto='payment';
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
$result .= $linkstart;
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
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);
|
||||||
$result.=$link.$this->ref.$linkend;
|
if ($withpicto != 2) $result.= $this->ref;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -165,12 +165,13 @@ if ($conf->use_javascript_ajax)
|
|||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder nohover" width="100%">';
|
print '<table class="noborder nohover" width="100%">';
|
||||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||||
print '<tr '.$bc[0].'><td align="center" colspan="2">';
|
print '<tr><td align="center" colspan="2">';
|
||||||
|
|
||||||
$SommeA=0;
|
$SommeA=0;
|
||||||
$SommeB=0;
|
$SommeB=0;
|
||||||
$SommeC=0;
|
$SommeC=0;
|
||||||
$SommeD=0;
|
$SommeD=0;
|
||||||
|
$total=0;
|
||||||
$dataval=array();
|
$dataval=array();
|
||||||
$datalabels=array();
|
$datalabels=array();
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -187,14 +188,23 @@ if ($conf->use_javascript_ajax)
|
|||||||
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
$total = $SommeA + $SommeB + $SommeC + $SommeD;
|
||||||
$dataseries=array();
|
$dataseries=array();
|
||||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'data'=>round($SommeB));
|
$dataseries[]=array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
|
||||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'data'=>round($SommeC));
|
$dataseries[]=array($langs->trans("MenuMembersUpToDate"), round($SommeC));
|
||||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'data'=>round($SommeD));
|
$dataseries[]=array($langs->trans("MembersStatusResiliated"), round($SommeD));
|
||||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'data'=>round($SommeA));
|
$dataseries[]=array($langs->trans("MembersStatusToValid"), round($SommeA));
|
||||||
$data=array('series'=>$dataseries);
|
|
||||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
$dolgraph = new DolGraph();
|
||||||
|
$dolgraph->SetData($dataseries);
|
||||||
|
$dolgraph->setShowLegend(1);
|
||||||
|
$dolgraph->setShowPercent(1);
|
||||||
|
$dolgraph->SetType(array('pie'));
|
||||||
|
$dolgraph->setWidth('100%');
|
||||||
|
$dolgraph->draw('idgraphstatus');
|
||||||
|
print $dolgraph->show($total?0:1);
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
|
||||||
print $SommeA+$SommeB+$SommeC+$SommeD;
|
print $SommeA+$SommeB+$SommeC+$SommeD;
|
||||||
|
|||||||
@ -244,19 +244,8 @@ if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
|
|||||||
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
||||||
|
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
|
||||||
$mode=0;
|
|
||||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
|
||||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
|
||||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
|
||||||
{
|
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -343,21 +332,15 @@ if ($filter) $param.="&filter=".urlencode($filter);
|
|||||||
if ($search_type > 0) $param.="&search_type=".urlencode($search_type);
|
if ($search_type > 0) $param.="&search_type=".urlencode($search_type);
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
|
||||||
}
|
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
// 'presend'=>$langs->trans("SendByMail"),
|
// 'presend'=>$langs->trans("SendByMail"),
|
||||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -372,6 +355,12 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|||||||
|
|
||||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||||
|
|
||||||
|
$topicmail="Information";
|
||||||
|
$modelmail="member";
|
||||||
|
$objecttmp=new Adherent($db);
|
||||||
|
$trackid='mem'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
@ -523,28 +512,8 @@ if (! empty($arrayfields['d.datefin']['checked']))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
|
||||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$searchclass='';
|
|
||||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
|
||||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
|
||||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -604,19 +573,8 @@ if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titr
|
|||||||
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
$sortonfield = "ef.".$key;
|
|
||||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
|
||||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -801,23 +759,7 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
print '<td';
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
if ($align) print ' align="'.$align.'"';
|
|
||||||
print '>';
|
|
||||||
$tmpkey='options_'.$key;
|
|
||||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@ -834,13 +834,15 @@ if ($rowid > 0)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$accountstatic=new Account($db);
|
$accountstatic=new Account($db);
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
print '<tr class="oddeven">';
|
|
||||||
$subscriptionstatic->ref=$objp->crowid;
|
$subscriptionstatic->ref=$objp->crowid;
|
||||||
$subscriptionstatic->id=$objp->crowid;
|
$subscriptionstatic->id=$objp->crowid;
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
|
||||||
@ -885,18 +887,21 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Shon online payment link
|
if (($action != 'addsubscription' && $action != 'create_thirdparty'))
|
||||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
|
||||||
|
|
||||||
if ($useonlinepayment)
|
|
||||||
{
|
{
|
||||||
print '<br>';
|
// Shon online payment link
|
||||||
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
if ($useonlinepayment)
|
||||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add new subscription form
|
* Add new subscription form
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -177,9 +177,8 @@ if ($result)
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -194,6 +193,12 @@ if ($result)
|
|||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||||
|
|
||||||
|
$topicmail="Information";
|
||||||
|
$modelmail="subscription";
|
||||||
|
$objecttmp=new Subscription($db);
|
||||||
|
$trackid='sub'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||||
|
|||||||
@ -204,10 +204,10 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||||
|
|
||||||
|
|
||||||
// List of members type
|
// List of members type
|
||||||
if (! $rowid && $action != 'create' && $action != 'edit')
|
if (! $rowid && $action != 'create' && $action != 'edit')
|
||||||
@ -252,11 +252,21 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
|||||||
print '<th> </th>';
|
print '<th> </th>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$membertype = new AdherentType($db);
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$membertype->id = $objp->rowid;
|
||||||
|
$membertype->ref = $objp->rowid;
|
||||||
|
$membertype->label = $objp->rowid;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
|
print '<td>';
|
||||||
|
print $membertype->getNomUrl(1);
|
||||||
|
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||||
|
print '</td>';
|
||||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||||
print '<td align="center">'.yn($objp->subscription).'</td>';
|
print '<td align="center">'.yn($objp->subscription).'</td>';
|
||||||
print '<td align="center">'.yn($objp->vote).'</td>';
|
print '<td align="center">'.yn($objp->vote).'</td>';
|
||||||
@ -440,11 +450,11 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
if ($status != '')
|
if ($status != '')
|
||||||
{
|
{
|
||||||
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
$sql.= natural_search('d.statut', $status, 2);
|
||||||
}
|
}
|
||||||
if ($action == 'search')
|
if ($action == 'search')
|
||||||
{
|
{
|
||||||
if (GETPOST('search'))
|
if (GETPOST('search','alpha'))
|
||||||
{
|
{
|
||||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,9 +158,10 @@ $head=agenda_prepare_head();
|
|||||||
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
|
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
|
||||||
|
|
||||||
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
|
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
|
||||||
print $langs->trans("OnlyActiveElementsAreShown").'<br>';
|
print $langs->trans("OnlyActiveElementsAreShown", 'modules.php').'<br>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
||||||
@ -172,9 +173,9 @@ print $searchpicto;
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th class="liste_titre">'.$langs->trans("ActionsEvents").'</th>';
|
print '<th class="liste_titre" colspan="2">'.$langs->trans("ActionsEvents").'</th>';
|
||||||
print '<th class="liste_titre"></th>';
|
|
||||||
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
|
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
// Show each trigger (list is in c_action_trigger)
|
// Show each trigger (list is in c_action_trigger)
|
||||||
@ -211,6 +212,7 @@ if (! empty($triggers))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
@ -248,10 +248,8 @@ if ($resql)
|
|||||||
// Check record to know if we must recalculate sort order
|
// Check record to know if we must recalculate sort order
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$decalage=0;
|
$decalage=0;
|
||||||
$var=false;
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$boxes[$obj->position][$obj->box_id]=1;
|
$boxes[$obj->position][$obj->box_id]=1;
|
||||||
$i++;
|
$i++;
|
||||||
@ -321,6 +319,8 @@ if ($resql)
|
|||||||
|
|
||||||
// Available boxes to activate
|
// Available boxes to activate
|
||||||
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
|
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
|
||||||
|
// Activated boxes
|
||||||
|
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||||
@ -339,11 +339,9 @@ print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
|||||||
print '<td>'.$langs->trans("SourceFile").'</td>';
|
print '<td>'.$langs->trans("SourceFile").'</td>';
|
||||||
print '<td width="160" align="center">'.$langs->trans("ActivateOn").'</td>';
|
print '<td width="160" align="center">'.$langs->trans("ActivateOn").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=true;
|
|
||||||
foreach($boxtoadd as $box)
|
foreach($boxtoadd as $box)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
{
|
{
|
||||||
$logo = $box->boximg;
|
$logo = $box->boximg;
|
||||||
@ -376,7 +374,10 @@ foreach($boxtoadd as $box)
|
|||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
}
|
}
|
||||||
|
if (! count($boxtoadd) && count($boxactivated))
|
||||||
|
{
|
||||||
|
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("AllWidgetsWereEnabled").'</td></tr>';
|
||||||
|
}
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -387,8 +388,6 @@ print '</form>';
|
|||||||
print "\n".'<!-- End Boxes Available -->'."\n";
|
print "\n".'<!-- End Boxes Available -->'."\n";
|
||||||
|
|
||||||
|
|
||||||
// Activated boxes
|
|
||||||
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
|
||||||
//var_dump($boxactivated);
|
//var_dump($boxactivated);
|
||||||
print "<br>\n\n";
|
print "<br>\n\n";
|
||||||
print load_fiche_titre($langs->trans("BoxesActivated"));
|
print load_fiche_titre($langs->trans("BoxesActivated"));
|
||||||
@ -404,13 +403,10 @@ print '<td align="center" width="60" colspan="2">'.$langs->trans("PositionByDefa
|
|||||||
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$var=true;
|
|
||||||
$box_order=1;
|
$box_order=1;
|
||||||
$foundrupture=1;
|
$foundrupture=1;
|
||||||
foreach($boxactivated as $key => $box)
|
foreach($boxactivated as $key => $box)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
{
|
{
|
||||||
$logo = $box->boximg;
|
$logo = $box->boximg;
|
||||||
@ -462,7 +458,6 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|||||||
print '<input type="hidden" name="action" value="addconst">';
|
print '<input type="hidden" name="action" value="addconst">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$var=false;
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">'.$langs->trans("Parameter").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Parameter").'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans("Value").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Value").'</td>';
|
||||||
|
|||||||
@ -69,6 +69,8 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
|||||||
|
|
||||||
$s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
|
$s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
activateModulesRequiredByCountry($mysoc->country_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
|
|||||||
@ -276,7 +276,7 @@ if ($mode != 'focus')
|
|||||||
{
|
{
|
||||||
$texthelp.=$key.' -> '.$val.'<br>';
|
$texthelp.=$key.' -> '.$val.'<br>';
|
||||||
}
|
}
|
||||||
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -80,6 +80,10 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
$search_country_id = GETPOST('search_country_id','int');
|
$search_country_id = GETPOST('search_country_id','int');
|
||||||
|
if ($search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
|
||||||
|
{
|
||||||
|
$search_country_id = $mysoc->country_id;
|
||||||
|
}
|
||||||
$search_code = GETPOST('search_code','alpha');
|
$search_code = GETPOST('search_code','alpha');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
@ -89,7 +93,7 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,35,36,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
|
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
@ -281,6 +285,8 @@ $tabfield[29]= "code,label,percent,position";
|
|||||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
//$tabfield[31]= "pcg_version,label";
|
//$tabfield[31]= "pcg_version,label";
|
||||||
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||||
|
$tabfield[33]= "code,label";
|
||||||
|
$tabfield[34]= "code,label";
|
||||||
$tabfield[35]= "label";
|
$tabfield[35]= "label";
|
||||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||||
|
|
||||||
@ -799,7 +805,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
$sql.= " AND entity = '".getEntity($tabname[$id])."'";
|
if (in_array('entity', $listfieldmodify)) $sql.= " AND entity = '".getEntity($tabname[$id])."'";
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
@ -1009,6 +1015,11 @@ if ($id)
|
|||||||
$sql.=$db->plimit($listlimit+1,$offset);
|
$sql.=$db->plimit($listlimit+1,$offset);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
|
if (empty($tabfield[$id]))
|
||||||
|
{
|
||||||
|
dol_print_error($db, 'The table with id '.$id.' has no array tabfield defined');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
@ -1392,6 +1403,7 @@ if ($id)
|
|||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
//var_dump($fieldlist);
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
@ -1749,7 +1761,7 @@ $db->close();
|
|||||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||||
* @param string $tabname Name of SQL table
|
* @param string $tabname Name of SQL table
|
||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return string '' or value of entity into table
|
* @return string '' or value of entity into table
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if ($action == 'update')
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
|
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
$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('ConfigLoan'),$linkback,'title_setup');
|
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
|
||||||
|
|||||||
@ -587,9 +587,13 @@ else
|
|||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
|
|
||||||
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
|
if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot')
|
||||||
|
{
|
||||||
|
print $langs->trans('RobotEmail');
|
||||||
|
}
|
||||||
|
else if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
|
||||||
{
|
{
|
||||||
print $langs->trans('UserEmail');
|
print $langs->trans('UserEmail');
|
||||||
}
|
}
|
||||||
@ -724,10 +728,13 @@ else
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
|
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||||
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
|
$formmail->fromid=$user->id;
|
||||||
$formmail->withfromreadonly=0;
|
$formmail->fromalsorobot=1;
|
||||||
|
$formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||||
|
$formmail->withfromreadonly=1;
|
||||||
$formmail->withsubstit=0;
|
$formmail->withsubstit=0;
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
$formmail->witherrorsto=1;
|
$formmail->witherrorsto=1;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
|
|||||||
// Load traductions files requiredby by page
|
// Load traductions files requiredby by page
|
||||||
$langs->loadLangs(array("errors","admin","mails","languages"));
|
$langs->loadLangs(array("errors","admin","mails","languages"));
|
||||||
|
|
||||||
$action = GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action = GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||||
$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
|
$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
|
||||||
$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
|
$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
|
||||||
$confirm = GETPOST('confirm','alpha'); // Result of a confirmation
|
$confirm = GETPOST('confirm','alpha'); // Result of a confirmation
|
||||||
@ -71,7 +71,7 @@ $pagenext = $page + 1;
|
|||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
$object=new EmailSenderProfile($db);
|
$object=new EmailSenderProfile($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$diroutputmassaction=$conf->monmodule->dir_output . '/temp/massgeneration/'.$user->id;
|
$diroutputmassaction=$conf->admin->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
$hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array
|
$hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array
|
||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
|
$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
|
||||||
@ -205,9 +205,10 @@ $parameters=array();
|
|||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql=preg_replace('/, $/','', $sql);
|
$sql=preg_replace('/, $/','', $sql);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_email_senderprofile as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."emailsenderprofile_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE t.entity IN (".getEntity('emailsenderprofile').")";
|
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('emailsenderprofile').")";
|
||||||
|
else $sql.=" WHERE 1 = 1";
|
||||||
foreach($search as $key => $val)
|
foreach($search as $key => $val)
|
||||||
{
|
{
|
||||||
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
$mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0);
|
||||||
@ -215,19 +216,7 @@ foreach($search as $key => $val)
|
|||||||
}
|
}
|
||||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
|
||||||
$mode_search=0;
|
|
||||||
if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric
|
|
||||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
|
|
||||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
|
||||||
{
|
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
@ -259,7 +248,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
dol_syslog($script_file, LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
@ -305,20 +293,15 @@ foreach($search as $key => $val)
|
|||||||
}
|
}
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
|
||||||
}
|
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
if ($user->rights->monmodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
|
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -333,6 +316,12 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|||||||
|
|
||||||
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
$topicmail="Information";
|
||||||
|
//$modelmail="subscription";
|
||||||
|
$objecttmp=new EmailSenderProfile($db);
|
||||||
|
//$trackid='sub'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
/*$moreforfilter.='<div class="divsearchfield">';
|
/*$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||||
@ -363,50 +352,18 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
|
||||||
$align='';
|
$align='';
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
|
||||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key]))
|
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$searchclass='';
|
|
||||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
|
||||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
|
||||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Rest of fields search
|
|
||||||
foreach($object->fields as $key => $val)
|
|
||||||
{
|
|
||||||
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
|
||||||
$align='';
|
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
|
||||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
|
||||||
}
|
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@ -420,41 +377,19 @@ print '</tr>'."\n";
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
|
||||||
$align='';
|
$align='';
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
$sortonfield = "ef.".$key;
|
|
||||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
|
||||||
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Rest of fields title
|
|
||||||
foreach($object->fields as $key => $val)
|
|
||||||
{
|
|
||||||
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
|
||||||
$align='';
|
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
|
||||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
|
||||||
}
|
|
||||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
@ -487,77 +422,31 @@ while ($i < min($num, $limit))
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
foreach($object->fields as $key => $val)
|
foreach($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
|
||||||
$align='';
|
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
|
||||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
|
||||||
{
|
|
||||||
print '<td'.($align?' class="'.$align.'"':'').'>';
|
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
|
||||||
elseif ($key == 'ref') print $object->getNomUrl(1, '', 0, '', 1);
|
|
||||||
elseif ($key == 'status') print $object->getLibStatut(3);
|
|
||||||
else print $obj->$key;
|
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
if (! empty($val['isameasure']))
|
|
||||||
{
|
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
|
||||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Extra fields
|
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
print '<td';
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
if ($align) print ' align="'.$align.'"';
|
|
||||||
print '>';
|
|
||||||
$tmpkey='options_'.$key;
|
|
||||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
if (! empty($val['isameasure']))
|
|
||||||
{
|
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
|
|
||||||
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fields from hook
|
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
// Rest of fields
|
|
||||||
foreach($object->fields as $key => $val)
|
|
||||||
{
|
|
||||||
if (! in_array($key, array('date_creation', 'tms', 'import_key', 'status'))) continue;
|
|
||||||
$align='';
|
$align='';
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||||
{
|
{
|
||||||
print '<td'.($align?' class="'.$align.'"':'').'>';
|
print '<td';
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
if ($align) print ' class="'.$align.'"';
|
||||||
elseif ($key == 'status') print $object->getLibStatut(3);
|
print '>';
|
||||||
else print $obj->$key;
|
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
if (! empty($val['isameasure']))
|
if (! empty($val['isameasure']))
|
||||||
{
|
{
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="nowrap" align="center">';
|
print '<td class="nowrap" align="center">';
|
||||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
@ -629,7 +518,7 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb
|
|||||||
|
|
||||||
$filedir=$diroutputmassaction;
|
$filedir=$diroutputmassaction;
|
||||||
$genallowed=$user->rights->monmodule->read;
|
$genallowed=$user->rights->monmodule->read;
|
||||||
$delallowed=$user->rights->monmodule->read;
|
$delallowed=$user->rights->monmodule->create;
|
||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
print $formfile->showdocuments('massfilesarea_monmodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -270,6 +270,7 @@ if (empty($reshook))
|
|||||||
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
||||||
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
||||||
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
|
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
|
||||||
|
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null";
|
||||||
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -708,8 +709,8 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
if (! empty($tabhelp[$id][$value]))
|
if (! empty($tabhelp[$id][$value]))
|
||||||
{
|
{
|
||||||
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
|
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click
|
||||||
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
|
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover
|
||||||
}
|
}
|
||||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->loadLangs(array("errors","admin","modulebuilder"));
|
||||||
$langs->load("admin");
|
|
||||||
|
|
||||||
$mode=GETPOST('mode', 'alpha');
|
$mode=GETPOST('mode', 'alpha');
|
||||||
if (empty($mode)) $mode='common';
|
if (empty($mode)) $mode='common';
|
||||||
@ -95,6 +94,8 @@ $hookmanager->initHooks(array('adminmodules','globaladmin'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$formconfirm = '';
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
@ -237,8 +238,7 @@ if ($action == 'set' && $user->admin)
|
|||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
|
||||||
if ($action == 'reset' && $user->admin)
|
|
||||||
{
|
{
|
||||||
$result=unActivateModule($value);
|
$result=unActivateModule($value);
|
||||||
if ($result) setEventMessages($result, null, 'errors');
|
if ($result) setEventMessages($result, null, 'errors');
|
||||||
@ -424,6 +424,22 @@ foreach ($modulesdir as $dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'reset_confirm' && $user->admin)
|
||||||
|
{
|
||||||
|
if(!empty($modules[$value])) {
|
||||||
|
$objMod = $modules[$value];
|
||||||
|
|
||||||
|
if(!empty($objMod->langfiles)) $langs->loadLangs($objMod->langfiles);
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print $formconfirm;
|
||||||
|
|
||||||
asort($orders);
|
asort($orders);
|
||||||
//var_dump($orders);
|
//var_dump($orders);
|
||||||
//var_dump($categ);
|
//var_dump($categ);
|
||||||
@ -680,9 +696,20 @@ if ($mode == 'common')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode . $param . '">';
|
if(!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
|
||||||
print img_picto($langs->trans("Activated"),'switch_on');
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value=' . $modName . '&mode=' . $mode . $param . '">';
|
||||||
print '</a>';
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
print '</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode .'&confirm=yes' . $param . '">';
|
||||||
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
print '</a>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
|
||||||
@ -1009,9 +1036,21 @@ if ($mode == 'develop')
|
|||||||
print '<td>'.$langs->trans("URL").'</td>';
|
print '<td>'.$langs->trans("URL").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "<tr class=\"oddeven\">\n";
|
print '<tr class="oddeven" height="80">'."\n";
|
||||||
|
print '<td align="left">';
|
||||||
|
//span class="fa fa-bug"></span>
|
||||||
|
//print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">';
|
||||||
|
print '<div class="imgmaxheight50 logo_setup"></div>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td>'.$langs->trans("TryToUseTheModuleBuilder").'</td>';
|
||||||
|
print '<td>'.$langs->trans("SeeTopRightMenu").'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven" height="80">'."\n";
|
||||||
$url='https://partners.dolibarr.org';
|
$url='https://partners.dolibarr.org';
|
||||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
|
print '<td align="left">';
|
||||||
|
print'<a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a>';
|
||||||
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
||||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -47,7 +47,7 @@ $action = GETPOST('action', 'alpha');
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -86,7 +86,7 @@ print '<input type="hidden" name="action" value="update">';
|
|||||||
|
|
||||||
$head = oauthadmin_prepare_head();
|
$head = oauthadmin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'services', '', 0, 'technic');
|
dol_fiche_head($head, 'services', '', -1, 'technic');
|
||||||
|
|
||||||
|
|
||||||
print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
|
print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
|
||||||
@ -102,10 +102,10 @@ foreach ($list as $key)
|
|||||||
if (! $supported) continue; // show only supported
|
if (! $supported) continue; // show only supported
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
print '<tr class="liste_titre'.($i > 1 ?' liste_titre_add':'').'">';
|
print '<tr class="liste_titre'.($i > 1 ?' liste_titre_add':'').'">';
|
||||||
// Api Name
|
// Api Name
|
||||||
$label = $langs->trans($key[0]);
|
$label = $langs->trans($key[0]);
|
||||||
print '<td>'.$label.'</td>';
|
print '<td>'.$label.'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (! empty($key[3])) print $langs->trans($key[3]);
|
if (! empty($key[3])) print $langs->trans($key[3]);
|
||||||
@ -127,7 +127,7 @@ foreach ($list as $key)
|
|||||||
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
|
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Api Id
|
// Api Id
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>';
|
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>';
|
||||||
|
|||||||
@ -118,7 +118,7 @@ print load_fiche_titre($langs->trans('ConfigOAuth'),$linkback,'title_setup');
|
|||||||
|
|
||||||
$head=oauthadmin_prepare_head($mode);
|
$head=oauthadmin_prepare_head($mode);
|
||||||
|
|
||||||
dol_fiche_head($head, 'tokengeneration', '', 0, 'technic');
|
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
||||||
|
|
||||||
|
|
||||||
if ($mode == 'setup' && $user->admin)
|
if ($mode == 'setup' && $user->admin)
|
||||||
@ -131,8 +131,8 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
$supported=0;
|
$supported=0;
|
||||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1;
|
if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1;
|
||||||
if (! $supported) continue; // show only supported
|
if (! $supported) continue; // show only supported
|
||||||
|
|
||||||
|
|
||||||
$OAUTH_SERVICENAME='Unknown';
|
$OAUTH_SERVICENAME='Unknown';
|
||||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
$urltodelete=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
$urltodelete=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||||
$urltocheckperms='https://security.google.com/settings/security/permissions';
|
$urltocheckperms='https://security.google.com/settings/security/permissions';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show value of token
|
// Show value of token
|
||||||
$tokenobj=null;
|
$tokenobj=null;
|
||||||
// Token
|
// Token
|
||||||
@ -164,21 +164,21 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
{
|
{
|
||||||
// Return an error if token not found
|
// Return an error if token not found
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set other properties
|
// Set other properties
|
||||||
$refreshtoken=false;
|
$refreshtoken=false;
|
||||||
$expiredat='';
|
$expiredat='';
|
||||||
|
|
||||||
$expire = false;
|
$expire = false;
|
||||||
// Is token expired or will token expire in the next 30 seconds
|
// Is token expired or will token expire in the next 30 seconds
|
||||||
if (is_object($tokenobj)) {
|
if (is_object($tokenobj)) {
|
||||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key[1] != '' && $key[2] != '') {
|
if ($key[1] != '' && $key[2] != '') {
|
||||||
if (is_object($tokenobj)) {
|
if (is_object($tokenobj)) {
|
||||||
$refreshtoken = $tokenobj->getRefreshToken();
|
$refreshtoken = $tokenobj->getRefreshToken();
|
||||||
|
|
||||||
$endoflife = $tokenobj->getEndOfLife();
|
$endoflife = $tokenobj->getEndOfLife();
|
||||||
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
||||||
{
|
{
|
||||||
@ -196,21 +196,21 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$submit_enabled=0;
|
$submit_enabled=0;
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="setconst">';
|
print '<input type="hidden" name="action" value="setconst">';
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
|
|
||||||
$var=false;
|
$var=false;
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||||
print '<th></th>';
|
print '<th></th>';
|
||||||
print '<th></th>';
|
print '<th></th>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td'.($key['required']?' class="required"':'').'>';
|
print '<td'.($key['required']?' class="required"':'').'>';
|
||||||
//var_dump($key);
|
//var_dump($key);
|
||||||
@ -221,7 +221,7 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td'.($key['required']?' class="required"':'').'>';
|
print '<td'.($key['required']?' class="required"':'').'>';
|
||||||
@ -248,7 +248,7 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td'.($key['required']?' class="required"':'').'>';
|
print '<td'.($key['required']?' class="required"':'').'>';
|
||||||
@ -265,7 +265,7 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
||||||
print ''.join(',',$tokenobj->getExtraParams());
|
print ''.join(',',$tokenobj->getExtraParams());
|
||||||
print '</textarea>';*/
|
print '</textarea>';*/
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
print yn($refreshtoken);
|
print yn($refreshtoken);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Token expired
|
// Token expired
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -292,7 +292,7 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
print yn($expire);
|
print yn($expire);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Token expired at
|
// Token expired at
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -302,9 +302,9 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $expiredat;
|
print $expiredat;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if (! empty($driver))
|
if (! empty($driver))
|
||||||
@ -314,10 +314,10 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'test' && $user->admin)
|
if ($mode == 'test' && $user->admin)
|
||||||
@ -344,7 +344,7 @@ if ($mode == 'test' && $user->admin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ if ($mode == 'userconf' && $user->admin)
|
|||||||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
while ($row=$db->fetch_array($resql)) {
|
while ($row=$db->fetch_array($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$row['login'].'</td>';
|
print '<td>'.$row['login'].'</td>';
|
||||||
print '<td>'.$row['module'].'</td>';
|
print '<td>'.$row['module'].'</td>';
|
||||||
|
|||||||
@ -74,13 +74,13 @@ if ($action == "set")
|
|||||||
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"),'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
if (GETPOST("PRELEVEMENT_USER") > 0)
|
if (GETPOST("PRELEVEMENT_USER") > 0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -155,7 +155,7 @@ if ($action == 'specimen')
|
|||||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default model
|
// Set default model
|
||||||
else if ($action == 'setdoc')
|
else if ($action == 'setdoc')
|
||||||
@ -411,7 +411,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
|||||||
|
|
||||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_soc, u.email";
|
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_soc, u.email";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
$sql.= " WHERE entity IN (".getEntity('facture').")";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -422,7 +422,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
if (!$obj->fk_soc)
|
if (!$obj->fk_soc)
|
||||||
{
|
{
|
||||||
$username=dolGetFirstLastname($obj->firstname,$obj->lastname);
|
$username=dolGetFirstLastname($obj->firstname,$obj->lastname);
|
||||||
@ -495,7 +495,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.dolGetFirstLastname($obj->firstname,$obj->lastname).'</td>';
|
print '<td>'.dolGetFirstLastname($obj->firstname,$obj->lastname).'</td>';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
@ -120,8 +120,13 @@ if (function_exists('curl_init'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now show link to the changelog
|
||||||
print ' - ';
|
print ' - ';
|
||||||
print '<a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/develop/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
|
|
||||||
|
$version=DOL_VERSION;
|
||||||
|
if (preg_match('/[a-z]+/i', $version)) $version='develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
|
||||||
|
|
||||||
|
print '<a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
|
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
|
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
|
||||||
@ -258,7 +263,7 @@ print '</td></tr>'."\n";
|
|||||||
print '<tr class="oddeven"><td> => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
|
print '<tr class="oddeven"><td> => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
|
||||||
|
|
||||||
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
|
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n";
|
||||||
|
|
||||||
$tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
$tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
||||||
if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows
|
if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows
|
||||||
|
|||||||
@ -113,7 +113,7 @@ if ($action == 'update') {
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
|
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
$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('TaxSetup'),$linkback,'title_setup');
|
print load_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup');
|
||||||
|
|||||||
@ -214,10 +214,13 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>
|
||||||
<div class="formelementrow"><input type="checkbox" name="disable_fk"
|
<div class="formelementrow"><input type="checkbox" name="disable_fk"
|
||||||
value="yes" id="checkbox_disable_fk" checked /> <label
|
value="yes" id="checkbox_disable_fk" checked /> <label
|
||||||
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
|
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label>
|
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label>
|
||||||
|
|
||||||
<select name="sql_compat" id="select_sql_compat" class="flat">
|
<select name="sql_compat" id="select_sql_compat" class="flat">
|
||||||
@ -286,11 +289,12 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
|
|||||||
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label>
|
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>
|
||||||
<div class="formelementrow"><input type="checkbox" name="nobin_disable_fk"
|
<div class="formelementrow"><input type="checkbox" name="nobin_disable_fk"
|
||||||
value="yes" id="checkbox_disable_fk" checked /> <label
|
value="yes" id="checkbox_disable_fk" checked /> <label
|
||||||
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
|
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@ -463,6 +467,19 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
|||||||
$_SESSION["commandbackuptorun"]='';
|
$_SESSION["commandbackuptorun"]='';
|
||||||
$_SESSION["commandbackupresult"]='';
|
$_SESSION["commandbackupresult"]='';
|
||||||
}
|
}
|
||||||
|
if (! empty($_SESSION["commandbackuptorun"]))
|
||||||
|
{
|
||||||
|
print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user).':</font><br>'."\n";
|
||||||
|
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
|
||||||
|
print ajax_autoselect("commandbackuptoruntext", 0);
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
//print $paramclear;
|
||||||
|
|
||||||
|
$_SESSION["commandbackuplastdone"]='';
|
||||||
|
$_SESSION["commandbackuptorun"]='';
|
||||||
|
$_SESSION["commandbackupresult"]='';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</div> <!-- end div center button -->
|
</div> <!-- end div center button -->
|
||||||
|
|||||||
@ -214,10 +214,10 @@ else
|
|||||||
|
|
||||||
$_SESSION["commandbackupresult"]=$resultstring;
|
$_SESSION["commandbackupresult"]=$resultstring;
|
||||||
}
|
}
|
||||||
else
|
/*else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user), null, 'mesgs');
|
setEventMessages($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user), null, 'warnings');
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
global $errormsg;
|
global $errormsg;
|
||||||
|
|
||||||
// Set to UTF-8
|
// Set to UTF-8
|
||||||
if(is_a($db, 'DoliDBMysqli')) {
|
if (is_a($db, 'DoliDBMysqli')) {
|
||||||
/** @var DoliDBMysqli $db */
|
/** @var DoliDBMysqli $db */
|
||||||
$db->db->set_charset('utf8');
|
$db->db->set_charset('utf8');
|
||||||
} else {
|
} else {
|
||||||
@ -300,11 +300,17 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
/*!40101 SET NAMES utf8 */;
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
if (GETPOST("nobin_disable_fk")) $sqlhead .= "SET FOREIGN_KEY_CHECKS=0;\n";
|
if (GETPOST("nobin_disable_fk")) $sqlhead .= "SET FOREIGN_KEY_CHECKS=0;\n";
|
||||||
$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n";
|
//$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n";
|
||||||
if (GETPOST("nobin_use_transaction")) $sqlhead .= "SET AUTOCOMMIT=0;\nSTART TRANSACTION;\n";
|
if (GETPOST("nobin_use_transaction")) $sqlhead .= "SET AUTOCOMMIT=0;\nSTART TRANSACTION;\n";
|
||||||
|
|
||||||
fwrite($handle, $sqlhead);
|
fwrite($handle, $sqlhead);
|
||||||
@ -321,8 +327,8 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
fwrite($handle, "\n--\n-- Table structure for table `".$table."`\n--\n");
|
fwrite($handle, "\n--\n-- Table structure for table `".$table."`\n--\n");
|
||||||
|
|
||||||
if (GETPOST("nobin_drop")) fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n"); // Dropping table if exists prior to re create it
|
if (GETPOST("nobin_drop")) fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n"); // Dropping table if exists prior to re create it
|
||||||
//fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
|
fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
|
||||||
//fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
|
fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
|
||||||
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
|
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
|
||||||
$row2 = $db->fetch_row($resqldrop);
|
$row2 = $db->fetch_row($resqldrop);
|
||||||
if (empty($row2[1]))
|
if (empty($row2[1]))
|
||||||
@ -338,6 +344,7 @@ function backup_tables($outputfile, $tables='*')
|
|||||||
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
|
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
|
||||||
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
|
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
|
||||||
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
|
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
|
||||||
|
else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
|
||||||
|
|
||||||
$sql='SELECT * FROM '.$table;
|
$sql='SELECT * FROM '.$table;
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|||||||
@ -27,12 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("companies","products","admin","sms","other","errors"));
|
||||||
$langs->load("products");
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("sms");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("errors");
|
|
||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
@ -263,6 +258,11 @@ if ($mode == 'overwrite')
|
|||||||
{
|
{
|
||||||
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
||||||
|
|
||||||
|
$disabled='';
|
||||||
|
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
|
||||||
|
$disablededit='';
|
||||||
|
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disablededit=' disabled';
|
||||||
|
|
||||||
print '<div class="justify"><span class="opacitymedium">';
|
print '<div class="justify"><span class="opacitymedium">';
|
||||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||||
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||||
@ -291,9 +291,6 @@ if ($mode == 'overwrite')
|
|||||||
// Line to add new record
|
// Line to add new record
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
$disablededit='';
|
|
||||||
if ($action == 'edit') $disablededit=' disabled';
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
@ -315,9 +312,7 @@ if ($mode == 'overwrite')
|
|||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||||
//}
|
//}
|
||||||
$disabled='';
|
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add" title="'.dol_escape_htmltag($langs->trans("YouMustEnabledTranslationOverwriteBefore")).'">';
|
||||||
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
|
|
||||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -406,6 +401,7 @@ if ($mode == 'searchkey')
|
|||||||
// Search modules dirs
|
// Search modules dirs
|
||||||
$modulesdir = dolGetModulesDirs();
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
|
||||||
|
$nbtotaloffiles=0;
|
||||||
$nbempty=0;
|
$nbempty=0;
|
||||||
/*var_dump($langcode);
|
/*var_dump($langcode);
|
||||||
var_dump($transkey);
|
var_dump($transkey);
|
||||||
@ -420,6 +416,7 @@ if ($mode == 'searchkey')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
||||||
|
$i=0;
|
||||||
foreach($modulesdir as $keydir => $tmpsearchdir)
|
foreach($modulesdir as $keydir => $tmpsearchdir)
|
||||||
{
|
{
|
||||||
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
||||||
@ -432,10 +429,19 @@ if ($mode == 'searchkey')
|
|||||||
foreach($filearray as $file)
|
foreach($filearray as $file)
|
||||||
{
|
{
|
||||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||||
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
|
$moduledirname =(basename(dirname(dirname($dir_lang))));
|
||||||
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
|
|
||||||
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
$langkey=$tmpfile;
|
||||||
|
if ($i > 0) $langkey.='@'.$moduledirname;
|
||||||
|
//var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey);
|
||||||
|
|
||||||
|
$result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite
|
||||||
|
$result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only
|
||||||
|
if ($result < 0) print 'Failed to load language file '.$tmpfile.'<br>'."\n";
|
||||||
|
else $nbtotaloffiles++;
|
||||||
|
//print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||||
}
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now search into translation array
|
// Now search into translation array
|
||||||
@ -455,7 +461,7 @@ if ($mode == 'searchkey')
|
|||||||
|
|
||||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||||
$title = $langs->trans("TranslationKeySearch");
|
$title = $langs->trans("TranslationKeySearch");
|
||||||
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')';
|
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')';
|
||||||
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
|
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
|
||||||
|
|
||||||
print '<input type="hidden" id="action" name="action" value="search">';
|
print '<input type="hidden" id="action" name="action" value="search">';
|
||||||
|
|||||||
@ -27,8 +27,7 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->loadLangs(array("admin","workflow","propal","workflow","orders","supplier_proposals"));
|
||||||
$langs->load("workflow");
|
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
@ -68,21 +67,26 @@ print "<br>";
|
|||||||
|
|
||||||
// List of workflow we can enable
|
// List of workflow we can enable
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
$workflowcodes=array(
|
$workflowcodes=array(
|
||||||
// Automatic creation
|
// Automatic creation
|
||||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||||
// Automatic classification
|
'separator1'=>array('family'=>'separator', 'position'=>25),
|
||||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
// Automatic classification proposal
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>''),
|
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify_proposal', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'propal','warning'=>''),
|
||||||
|
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify_proposal', 'position'=>31, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'propal','warning'=>''),
|
||||||
|
// Automatic classification invoice
|
||||||
|
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify_order', 'position'=>40, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
//Moved as hidden feature: 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>42, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
'separator2'=>array('family'=>'separator', 'position'=>50),
|
||||||
|
// Automatic classification supplier proposal
|
||||||
|
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'propal','warning'=>''),
|
||||||
|
// Automatic classification supplier order
|
||||||
|
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'! empty($conf->fournisseur->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
|
||||||
@ -93,27 +97,53 @@ if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO We must sort on position here
|
// Sort on position
|
||||||
|
$workflowcodes = dol_sort_array($workflowcodes, 'position');
|
||||||
|
|
||||||
$nbqualified=0;
|
$nbqualified=0;
|
||||||
$oldfamily='';
|
$oldfamily='';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
|
|
||||||
foreach($workflowcodes as $key => $params)
|
foreach($workflowcodes as $key => $params)
|
||||||
{
|
{
|
||||||
$picto=$params['picto'];
|
$picto=$params['picto'];
|
||||||
$enabled=$params['enabled'];
|
$enabled=$params['enabled'];
|
||||||
$family=$params['family'];
|
$family=$params['family'];
|
||||||
if (! verifCond($enabled)) continue;
|
|
||||||
|
if ($family == 'separator')
|
||||||
|
{
|
||||||
|
print '</table><br>';
|
||||||
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! verifCond($enabled)) continue;
|
||||||
|
|
||||||
$nbqualified++;
|
$nbqualified++;
|
||||||
|
|
||||||
|
|
||||||
if ($oldfamily != $family)
|
if ($oldfamily != $family)
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">'."\n";
|
print '<tr class="liste_titre">'."\n";
|
||||||
print ' <td>';
|
print ' <td>';
|
||||||
if ($family == 'create') print $langs->trans("AutomaticCreation");
|
if ($family == 'create')
|
||||||
elseif ($family == 'classify') print $langs->trans("AutomaticClassification");
|
{
|
||||||
else print $langs->trans("Description");
|
print $langs->trans("AutomaticCreation");
|
||||||
|
}
|
||||||
|
elseif (preg_match('/classify_(.*)/', $family, $reg))
|
||||||
|
{
|
||||||
|
print $langs->trans("AutomaticClassification");
|
||||||
|
if ($reg[1] == 'proposal') print ' - '.$langs->trans('Proposal');
|
||||||
|
if ($reg[1] == 'order') print ' - '.$langs->trans('Order');
|
||||||
|
if ($reg[1] == 'supplier_proposal') print ' - '.$langs->trans('SupplierProposal');
|
||||||
|
if ($reg[1] == 'supplier_order') print ' - '.$langs->trans('SupplierOrder');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Description");
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* @deprecated Old explorer. Not using Swagger. See instead explorer in htdocs/api/index.php.
|
* @deprecated Old explorer. Not using Swagger. See instead explorer in htdocs/api/index.php.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -106,18 +106,7 @@ foreach ($modulesdir as $dir)
|
|||||||
{
|
{
|
||||||
while (($file_searched = readdir($handle_part))!==false)
|
while (($file_searched = readdir($handle_part))!==false)
|
||||||
{
|
{
|
||||||
// Support of the deprecated API.
|
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
|
||||||
{
|
|
||||||
$classname = ucwords($reg[1]).'Api';
|
|
||||||
require_once $dir_part.$file_searched;
|
|
||||||
if (class_exists($classname))
|
|
||||||
{
|
|
||||||
dol_syslog("Found deprecated API classname=".$classname." into ".$dir);
|
|
||||||
$api->r->addAPIClass($classname, '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]);
|
$classname = ucwords($reg[1]);
|
||||||
require_once $dir_part.$file_searched;
|
require_once $dir_part.$file_searched;
|
||||||
@ -126,8 +115,8 @@ foreach ($modulesdir as $dir)
|
|||||||
dol_syslog("Found API classname=".$classname." into ".$dir);
|
dol_syslog("Found API classname=".$classname." into ".$dir);
|
||||||
$listofapis[] = $classname;
|
$listofapis[] = $classname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg))
|
if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg))
|
||||||
{
|
{
|
||||||
@ -137,11 +126,11 @@ foreach ($modulesdir as $dir)
|
|||||||
$classname = ucfirst($classname);
|
$classname = ucfirst($classname);
|
||||||
require_once $dir_part.$file_searched;
|
require_once $dir_part.$file_searched;
|
||||||
|
|
||||||
if (class_exists($classname))
|
if (class_exists($classname))
|
||||||
{
|
{
|
||||||
dol_syslog("Found API classname=".$classname);
|
dol_syslog("Found API classname=".$classname);
|
||||||
$api->r->addAPIClass($classname,'');
|
$api->r->addAPIClass($classname,'');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Routes.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Routes.php';
|
||||||
@ -151,10 +140,10 @@ foreach ($modulesdir as $dir)
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new RestException(500, "Error while parsing comments of `$classname` class. " . $e->getMessage());
|
throw new RestException(500, "Error while parsing comments of `$classname` class. " . $e->getMessage());
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
//$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched);
|
//$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched);
|
||||||
/* }
|
/* }
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,7 +185,7 @@ foreach($listofapis['v1'] as $key => $val)
|
|||||||
{
|
{
|
||||||
if ($key == 'login') continue;
|
if ($key == 'login') continue;
|
||||||
if ($key == 'index') continue;
|
if ($key == 'index') continue;
|
||||||
|
|
||||||
if ($key)
|
if ($key)
|
||||||
{
|
{
|
||||||
foreach($val as $method => $val2)
|
foreach($val as $method => $val2)
|
||||||
@ -204,8 +193,8 @@ foreach($listofapis['v1'] as $key => $val)
|
|||||||
$newclass=$val2['className'];
|
$newclass=$val2['className'];
|
||||||
|
|
||||||
if (preg_match('/restler/i', $newclass)) continue;
|
if (preg_match('/restler/i', $newclass)) continue;
|
||||||
|
|
||||||
if ($oldclass != $newclass)
|
if ($oldclass != $newclass)
|
||||||
{
|
{
|
||||||
print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n";
|
print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n";
|
||||||
$oldclass = $newclass;
|
$oldclass = $newclass;
|
||||||
@ -214,7 +203,7 @@ foreach($listofapis['v1'] as $key => $val)
|
|||||||
$url=$urlwithroot.'/api/index.php/'.$key;
|
$url=$urlwithroot.'/api/index.php/'.$key;
|
||||||
$url.='?api_key=token';
|
$url.='?api_key=token';
|
||||||
print img_picto('','object_globe.png').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
print img_picto('','object_globe.png').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -101,7 +101,7 @@ class DolibarrApi
|
|||||||
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
|
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
|
||||||
unset($object->linkedObjects);
|
unset($object->linkedObjects);
|
||||||
|
|
||||||
unset($object->lines); // should be ->lines
|
unset($object->lignes); // we don't want lignes, we want only ->lines
|
||||||
|
|
||||||
unset($object->fields);
|
unset($object->fields);
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,6 @@ use Luracast\Restler\Format\UploadFormat;
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for receive files
|
* API class for receive files
|
||||||
@ -119,6 +117,20 @@ class Documents extends DolibarrApi
|
|||||||
throw new RestException(500, 'Error generating document');
|
throw new RestException(500, 'Error generating document');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($module_part == 'commande' || $module_part == 'order')
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
|
$this->order = new Commande($this->db);
|
||||||
|
$result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Order not found');
|
||||||
|
}
|
||||||
|
$result = $this->order->generateDocument($this->order->modelpdf, $langs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if( $result <= 0 ) {
|
||||||
|
throw new RestException(500, 'Error generating document');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = basename($original_file);
|
$filename = basename($original_file);
|
||||||
@ -163,6 +175,8 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
|
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
|
||||||
{
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
|
||||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
@ -225,7 +239,7 @@ class Documents extends DolibarrApi
|
|||||||
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||||
*
|
*
|
||||||
* @param string $filename Name of file to create ('FA1705-0123')
|
* @param string $filename Name of file to create ('FA1705-0123.txt')
|
||||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
||||||
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
||||||
* @param string $subdir Subdirectory (Only if ref not provided)
|
* @param string $subdir Subdirectory (Only if ref not provided)
|
||||||
@ -271,15 +285,20 @@ class Documents extends DolibarrApi
|
|||||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||||
{
|
{
|
||||||
$modulepart='facture';
|
$modulepart='facture';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$object = new Facture($this->db);
|
$object = new Facture($this->db);
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'project')
|
elseif ($modulepart == 'project')
|
||||||
{
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
$object = new Project($this->db);
|
$object = new Project($this->db);
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'task' || $modulepart == 'project_task')
|
elseif ($modulepart == 'task' || $modulepart == 'project_task')
|
||||||
{
|
{
|
||||||
$modulepart = 'project_task';
|
$modulepart = 'project_task';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
$object = new Task($this->db);
|
$object = new Task($this->db);
|
||||||
|
|
||||||
$task_result = $object->fetch('', $ref);
|
$task_result = $object->fetch('', $ref);
|
||||||
|
|||||||
@ -208,6 +208,68 @@ class Setup extends DolibarrApi
|
|||||||
return $this->_cleanObjectDatas($country);
|
return $this->_cleanObjectDatas($country);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of delivery times.
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Number of items per page
|
||||||
|
* @param int $page Page number {@min 0}
|
||||||
|
* @param int $active Delivery times is active or not {@min 0} {@max 1}
|
||||||
|
* @param string $sqlfilters SQL criteria to filter with.
|
||||||
|
*
|
||||||
|
* @url GET dictionary/availability
|
||||||
|
*
|
||||||
|
* @return array [List of availability]
|
||||||
|
*
|
||||||
|
* @throws 400 RestException
|
||||||
|
* @throws 200 OK
|
||||||
|
*/
|
||||||
|
function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
|
{
|
||||||
|
$list = array();
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, code, label";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_availability as t";
|
||||||
|
$sql.= " WHERE t.active = ".$active;
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= $this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0) {
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$num = $this->db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
for ($i = 0; $i < $min; $i++) {
|
||||||
|
$list[] = $this->db->fetch_object($result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(400, $this->db->lasterror());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
|
|||||||
@ -96,7 +96,7 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
|||||||
|
|
||||||
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
||||||
$refreshcache=false;
|
$refreshcache=false;
|
||||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||||
{
|
{
|
||||||
$refreshcache=true;
|
$refreshcache=true;
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ $api = new DolibarrApi($db, '', $refreshcache);
|
|||||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||||
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
||||||
|
|
||||||
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat');
|
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat'); // 'YamlFormat'
|
||||||
$api->r->addAuthenticationClass('DolibarrApiAccess','');
|
$api->r->addAuthenticationClass('DolibarrApiAccess','');
|
||||||
|
|
||||||
// Define accepted mime types
|
// Define accepted mime types
|
||||||
@ -118,7 +118,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
|
|||||||
|
|
||||||
|
|
||||||
// Call Explorer file for all APIs definitions
|
// Call Explorer file for all APIs definitions
|
||||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||||
{
|
{
|
||||||
// Scan all API files to load them
|
// Scan all API files to load them
|
||||||
|
|
||||||
@ -163,22 +163,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
{
|
{
|
||||||
if ($file_searched == 'api_access.class.php') continue;
|
if ($file_searched == 'api_access.class.php') continue;
|
||||||
|
|
||||||
// Support of the deprecated API.
|
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
|
|
||||||
{
|
|
||||||
$classname = ucwords($regapi[1]).'Api';
|
|
||||||
require_once $dir_part.$file_searched;
|
|
||||||
if (class_exists($classname))
|
|
||||||
{
|
|
||||||
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
|
||||||
$api->r->addAPIClass($classname, '/');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
|
||||||
{
|
{
|
||||||
$classname = ucwords($regapi[1]);
|
$classname = ucwords($regapi[1]);
|
||||||
$classname = str_replace('_', '', $classname);
|
$classname = str_replace('_', '', $classname);
|
||||||
@ -213,15 +198,16 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
{
|
{
|
||||||
$api->r->addAPIClass($classname, $apiname);
|
$api->r->addAPIClass($classname, $apiname);
|
||||||
}
|
}
|
||||||
|
//var_dump($api->r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call one APIs or one definition of an API
|
// Call one APIs or one definition of an API
|
||||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
|
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
|
||||||
{
|
{
|
||||||
$module = $reg[1];
|
$module = $reg[1];
|
||||||
if ($module == 'explorer') // If we call page to explore details of a service
|
if ($module == 'explorer') // If we call page to explore details of a service
|
||||||
{
|
{
|
||||||
$module = $regbis[1];
|
$module = $regbis[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
$module=strtolower($module);
|
$module=strtolower($module);
|
||||||
@ -230,52 +216,33 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
|
|||||||
// Load a dedicated API file
|
// Load a dedicated API file
|
||||||
dol_syslog("Load a dedicated API file moduledirforclass=".$moduledirforclass);
|
dol_syslog("Load a dedicated API file moduledirforclass=".$moduledirforclass);
|
||||||
|
|
||||||
if (in_array($module, array('category','contact','customer','invoice','order','product','thirdparty','user'))) // Old Apis
|
$tmpmodule = $module;
|
||||||
{
|
if ($tmpmodule != 'api')
|
||||||
$classfile = $module;
|
$tmpmodule = preg_replace('/api$/i', '', $tmpmodule);
|
||||||
if ($module == 'customer') { $classfile = 'thirdparty'; }
|
$classfile = str_replace('_', '', $tmpmodule);
|
||||||
if ($module == 'order') { $classfile = 'commande'; }
|
if ($module == 'supplierproposals')
|
||||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_deprecated_'.$classfile.'.class.php', 0, 2);
|
$classfile = 'supplier_proposals';
|
||||||
$classname=ucwords($module);
|
if ($module == 'supplierorders')
|
||||||
if ($module == 'customer') { $classname='Thirdparty'; }
|
$classfile = 'supplier_orders';
|
||||||
if ($module == 'order') { $classname='Commande'; }
|
if ($module == 'supplierinvoices')
|
||||||
//var_dump($classfile);var_dump($classname);exit;
|
$classfile = 'supplier_invoices';
|
||||||
|
$dir_part_file = dol_buildpath('/' . $moduledirforclass . '/class/api_' . $classfile . '.class.php', 0, 2);
|
||||||
|
|
||||||
$res = false;
|
$classname = ucwords($module);
|
||||||
if ($dir_part_file) $res = include_once $dir_part_file;
|
|
||||||
if (! $res)
|
|
||||||
{
|
|
||||||
print 'API not found (failed to include API file)';
|
|
||||||
header('HTTP/1.1 501 API not found (failed to include API file)');
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$tmpmodule = $module;
|
|
||||||
if ($tmpmodule != 'api') $tmpmodule = preg_replace('/api$/i','', $tmpmodule);
|
|
||||||
$classfile = str_replace('_', '', $tmpmodule);
|
|
||||||
if ($module == 'supplierproposals') $classfile = 'supplier_proposals';
|
|
||||||
if ($module == 'supplierorders') $classfile = 'supplier_orders';
|
|
||||||
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
|
||||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
|
|
||||||
|
|
||||||
$classname=ucwords($module);
|
dol_syslog('Search /' . $moduledirforclass . '/class/api_' . $classfile . '.class.php => dir_part_file=' . $dir_part_file . ' classname=' . $classname);
|
||||||
|
|
||||||
dol_syslog('Search /'.$moduledirforclass.'/class/api_'.$classfile.'.class.php => dir_part_file='.$dir_part_file.' classname='.$classname);
|
$res = false;
|
||||||
|
if ($dir_part_file)
|
||||||
|
$res = include_once $dir_part_file;
|
||||||
|
if (! $res) {
|
||||||
|
print 'API not found (failed to include API file)';
|
||||||
|
header('HTTP/1.1 501 API not found (failed to include API file)');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
$res = false;
|
if (class_exists($classname))
|
||||||
if ($dir_part_file) $res = include_once $dir_part_file;
|
$api->r->addAPIClass($classname);
|
||||||
if (! $res)
|
|
||||||
{
|
|
||||||
print 'API not found (failed to include API file)';
|
|
||||||
header('HTTP/1.1 501 API not found (failed to include API file)');
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (class_exists($classname)) $api->r->addAPIClass($classname);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO If not found, redirect to explorer
|
// TODO If not found, redirect to explorer
|
||||||
|
|||||||
@ -236,7 +236,10 @@ if ($action == 'builddoc')
|
|||||||
{
|
{
|
||||||
$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, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, 'tmp_barcode_sheet.pdf');
|
|
||||||
|
$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(),'dayhourlog').'.pdf';
|
||||||
|
|
||||||
|
if (! $mesg) $result=doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
@ -292,9 +295,9 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
$labeltoshow=$_Avery_Labels[$codecards]['name'];
|
$labeltoshow=$_Avery_Labels[$codecards]['name'];
|
||||||
//$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
|
//$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
|
||||||
$arrayoflabels[$codecards]=$labeltoshow;
|
$arrayoflabels[$codecards]=$labeltoshow;
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
|
||||||
}
|
}
|
||||||
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
|
||||||
// Number of stickers to print
|
// Number of stickers to print
|
||||||
|
|||||||
23
htdocs/blockedlog/README-fr.md
Normal file
23
htdocs/blockedlog/README-fr.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
LOG INALTERABLE
|
||||||
|
===============
|
||||||
|
|
||||||
|
## Fonctionnalité
|
||||||
|
|
||||||
|
Ce module trace, en temps réel, certains évènements métiers dans une log inaltérable (que vous ne pouvez pas modifier une fois enregistrés) de type blockchain.
|
||||||
|
Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Fincance 2016 - Norme NF535).
|
||||||
|
|
||||||
|
|
||||||
|
**Les évènements tracés de manière inaltérables sont:**
|
||||||
|
|
||||||
|
- Création de facture
|
||||||
|
- Enregistrement des paiements
|
||||||
|
- Impression et téléchargement de facture faites via le logiciel
|
||||||
|
|
||||||
|
Remarque: Le type des événements tracés est probablement plus large que la plupart des exigences légales mais permet d'être prêt pour d'éventuel élargissement
|
||||||
|
de ces exigences.
|
||||||
|
Vous pouvez aussi lire et faire des recherches au sein de la log inaltérable.
|
||||||
|
|
||||||
|
Tous les enregistrements de la logs inaltérable sont liés avec le précédent dans une Blockchain, et leur contenu fait parti de la signature inclue dans ce lien,
|
||||||
|
aussi, une fois le module activé et le premier enregistrement réalisé, il ne sera plus possible d'effacer ni modifier un enregistrement dans la log
|
||||||
|
inaltérable sans corrompre toute la chaine. Dès lors qu'un enregistrement est invalide, tous les suivants pourront également être considérés invalides par votre administration.
|
||||||
|
|
||||||
22
htdocs/blockedlog/README.md
Normal file
22
htdocs/blockedlog/README.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
BLOCKED LOG
|
||||||
|
===========
|
||||||
|
|
||||||
|
## Feature
|
||||||
|
|
||||||
|
This module tracks, in real time, some events into a non reversible log (that you can't modify once recorded) into a block chain.
|
||||||
|
This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535).
|
||||||
|
|
||||||
|
|
||||||
|
**The tracked events are:**
|
||||||
|
|
||||||
|
- Invoices creation
|
||||||
|
- Payments record
|
||||||
|
- Invoice printing
|
||||||
|
|
||||||
|
You can also read and search into this dedicated log.
|
||||||
|
|
||||||
|
All record in the log are linked with the previous one in a blockchain, and content of the record is part of the
|
||||||
|
signature included into the link, so, once the module is activated, it is no more possible to erase or modify a record without corrupting all the chain.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,10 @@ $action = GETPOST('action','alpha');
|
|||||||
if (preg_match('/set_(.*)/',$action,$reg))
|
if (preg_match('/set_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0)
|
$values = GETPOST($code);
|
||||||
|
if(is_array($values))$values = implode(',', $values);
|
||||||
|
|
||||||
|
if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
exit;
|
exit;
|
||||||
@ -115,6 +118,35 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td>'.$langs->trans("BlockedLogDisableNotAllowedForCountry").'</td>';
|
||||||
|
print '<td align="right" width="300">';
|
||||||
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">';
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_country";
|
||||||
|
$sql.= " WHERE active > 0";
|
||||||
|
|
||||||
|
$countryArray=array();
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$seledted = empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY) ? array() : explode(',',$conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY);
|
||||||
|
|
||||||
|
print $form->multiselectarray('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $seledted);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</form>';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
364
htdocs/blockedlog/admin/blockedlog_list.php
Normal file
364
htdocs/blockedlog/admin/blockedlog_list.php
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/blockedlog/admin/blockedlog_list.php
|
||||||
|
* \ingroup blockedlog
|
||||||
|
* \brief Page setup for blockedlog module
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("blockedlog");
|
||||||
|
|
||||||
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search
|
||||||
|
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
|
||||||
|
$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
|
||||||
|
|
||||||
|
$search=array();
|
||||||
|
|
||||||
|
$showonlyerrors = GETPOST('showonlyerrors','int');
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
|
$page = GETPOST('page','int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
if (empty($sortfield)) $sortfield='rowid';
|
||||||
|
if (empty($sortorder)) $sortorder='DESC';
|
||||||
|
|
||||||
|
$search_start = -1;
|
||||||
|
if(GETPOST('search_startyear')!='') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
|
||||||
|
|
||||||
|
$search_end = -1;
|
||||||
|
if(GETPOST('search_endyear')!='') $search_end= dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$block_static = new BlockedLog($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$search_start = -1;
|
||||||
|
$search_end = -1;
|
||||||
|
$toselect='';
|
||||||
|
$search_array_options=array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'downloadblockchain') {
|
||||||
|
|
||||||
|
$auth = new BlockedLogAuthority($db);
|
||||||
|
|
||||||
|
$bc = $auth->getLocalBlockChain();
|
||||||
|
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header("Content-Transfer-Encoding: Binary");
|
||||||
|
header("Content-disposition: attachment; filename=\"" .$auth->signature. ".certif\"");
|
||||||
|
|
||||||
|
echo $bc;
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else if($action === 'downloadcsv') {
|
||||||
|
|
||||||
|
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||||
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
|
$sql.= " ORDER BY rowid ASC";
|
||||||
|
$res = $db->query($sql);
|
||||||
|
|
||||||
|
if($res) {
|
||||||
|
|
||||||
|
$signature = $block_static->getSignature();
|
||||||
|
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header("Content-Transfer-Encoding: Binary");
|
||||||
|
header("Content-disposition: attachment; filename=\"archive-log-" .$signature. ".csv\"");
|
||||||
|
|
||||||
|
print $langs->transnoentities('Id')
|
||||||
|
.';'.$langs->transnoentities('Date')
|
||||||
|
.';'.$langs->transnoentities('User')
|
||||||
|
.';'.$langs->transnoentities('Action')
|
||||||
|
.';'.$langs->transnoentities('Element')
|
||||||
|
.';'.$langs->transnoentities('Amounts')
|
||||||
|
.';'.$langs->transnoentities('ObjectId')
|
||||||
|
.';'.$langs->transnoentities('Date')
|
||||||
|
.';'.$langs->transnoentities('Ref')
|
||||||
|
.';'.$langs->transnoentities('Fingerprint')
|
||||||
|
.';'.$langs->transnoentities('FullData')
|
||||||
|
."\n";
|
||||||
|
|
||||||
|
while($obj = $db->fetch_object($res)) {
|
||||||
|
|
||||||
|
print $obj->rowid
|
||||||
|
.';'.$obj->date_creation
|
||||||
|
.';"'.$obj->user_fullname.'"'
|
||||||
|
.';'.$obj->action
|
||||||
|
.';'.$obj->element
|
||||||
|
.';'.$obj->amounts
|
||||||
|
.';'.$obj->fk_object
|
||||||
|
.';'.$obj->date_object
|
||||||
|
.';"'.$obj->ref_object.'"'
|
||||||
|
.';'.$obj->signature
|
||||||
|
.';"'.str_replace('"','""',$obj->object_data).'"'
|
||||||
|
."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
setEventMessage($db->lasterror, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
$blocks = $block_static->getLog('all', 0, GETPOST('all','alpha') ? 0 : 50, $sortfield, $sortorder, $search_start, $search_end);
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("BlockedLogSetup"));
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback);
|
||||||
|
|
||||||
|
$head=blockedlogadmin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'fingerprints', '', -1);
|
||||||
|
|
||||||
|
print $langs->trans("FingerprintsDesc")."<br>\n";
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
if ($search_start > 0) $param.='&search_startyear='.urlencode(GETPOST('search_startyear','int')).'&search_startmonth='.urlencode(GETPOST('search_startmonth','int')).'&search_startday='.urlencode(GETPOST('search_startday','int'));
|
||||||
|
if ($search_end > 0) $param.='&search_endyear='.urlencode(GETPOST('search_endyear','int')).'&search_endmonth='.urlencode(GETPOST('search_endmonth','int')).'&search_endday='.urlencode(GETPOST('search_endday','int'));
|
||||||
|
foreach($search as $key => $val)
|
||||||
|
{
|
||||||
|
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
|
}
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
|
// Add $param from extra fields
|
||||||
|
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
|
|
||||||
|
print '<div align="right">';
|
||||||
|
print ' <a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a>';
|
||||||
|
print ' | <a href="?all=1&showonlyerrors=1">'.$langs->trans('ShowAllFingerPrintsErrorsMightBeTooLong').'</a>';
|
||||||
|
print ' | <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a>';
|
||||||
|
print ' | <a href="?action=downloadcsv">'.$langs->trans('DownloadLogCSV').'</a>';
|
||||||
|
print ' </div>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
|
|
||||||
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre_filter">';
|
||||||
|
print '<td class="liste_titre"> </td>';
|
||||||
|
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print $form->select_date($search_start,'search_start');
|
||||||
|
print $form->select_date($search_end,'search_end');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="liste_titre" colspan="7"> </td>';
|
||||||
|
|
||||||
|
// Action column
|
||||||
|
print '<td class="liste_titre" align="middle">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print getTitleFieldOfList($langs->trans('#'), 0, $_SERVER["PHP_SELF"],'rowid','',$param,'',$sortfield,$sortorder,'minwidth50 ')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"],'date_creation','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"],'user_fullname','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"],'ref_object','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$loweridinerror=0;
|
||||||
|
$checkresult=array();
|
||||||
|
foreach($blocks as &$block) {
|
||||||
|
$checksignature = $block->checkSignature();
|
||||||
|
$checkresult[$block->id]=$checksignature; // false if error
|
||||||
|
if (! $checksignature)
|
||||||
|
{
|
||||||
|
if (empty($loweridinerror)) $loweridinerror=$block->id;
|
||||||
|
else $loweridinerror = min($loweridinerror, $block->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($blocks as &$block) {
|
||||||
|
$object_link = $block->getObjectLink();
|
||||||
|
|
||||||
|
if (empty($showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$block->id.'</td>';
|
||||||
|
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
|
||||||
|
print '<td>';
|
||||||
|
//print $block->getUser()
|
||||||
|
print $block->user_fullname;
|
||||||
|
print '</td>';
|
||||||
|
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
||||||
|
print '<td>'.$block->ref_object.'</td>';
|
||||||
|
print '<td>'.$object_link.'</td>';
|
||||||
|
print '<td align="right">'.price($block->amounts).'</td>';
|
||||||
|
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
if (! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
|
||||||
|
{
|
||||||
|
if ($checkresult[$block->id]) print img_picto($langs->trans('OkCheckFingerprintValidityButChainIsKo'), 'statut1');
|
||||||
|
else print img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_picto($langs->trans('OkCheckFingerprintValidity'), 'statut4');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
||||||
|
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<script type="text/javascript">
|
||||||
|
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery("#dialogforpopup").dialog(
|
||||||
|
{ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
|
||||||
|
maxHeight: window.innerHeight-60, height: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).',
|
||||||
|
modal: true,
|
||||||
|
autoOpen: false }).css("z-index: 5000");
|
||||||
|
|
||||||
|
$("a[rel=show-info]").click(function() {
|
||||||
|
|
||||||
|
console.log("We click on tooltip");
|
||||||
|
|
||||||
|
jQuery("#dialogforpopup").html(\'<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%">'.$langs->trans('Field').'</th><th>'.$langs->trans('Value').'</th></thead><tbody></tbody></table></div>\');
|
||||||
|
|
||||||
|
var fk_block = $(this).attr("data-blockid");
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url:"../ajax/block-info.php?id="+fk_block
|
||||||
|
,dataType:"json"
|
||||||
|
}).done(function(data) {
|
||||||
|
drawData(data,"");
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery("#dialogforpopup").dialog("open");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function drawData(data, prefix) {
|
||||||
|
for(x in data) {
|
||||||
|
value = data[x];
|
||||||
|
|
||||||
|
$("#pop-info table tbody").append("<tr><td>"+prefix+x+"</td><td class=\"wordwrap\">"+value+"</td></tr>");
|
||||||
|
if( (typeof value === "object") && (value !== null) ) {
|
||||||
|
drawData(value, prefix+x+" >> ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url : "<?php echo dol_buildpath('/blockedlog/ajax/check_signature.php',1) ?>"
|
||||||
|
,dataType:"html"
|
||||||
|
}).done(function(data) {
|
||||||
|
|
||||||
|
if(data == 'hashisok') {
|
||||||
|
$('#blockchainstatus').html('<?php echo $langs->trans('AuthorityReconizeFingerprintConformity'). ' '. img_picto($langs->trans('SignatureOK'), 'on') ?>');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#blockchainstatus').html('<?php echo $langs->trans('AuthorityDidntReconizeFingerprintConformity'). ' '.img_picto($langs->trans('SignatureKO'), 'off') ?>');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -1,261 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/blockedlog/admin/fingerprints.php
|
|
||||||
* \ingroup blockedlog
|
|
||||||
* \brief Page setup for blockedlog module
|
|
||||||
*/
|
|
||||||
|
|
||||||
require '../../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
||||||
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("blockedlog");
|
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
|
||||||
|
|
||||||
$action = GETPOST('action','alpha');
|
|
||||||
$showonlyerrors = GETPOST('showonlyerrors','int');
|
|
||||||
|
|
||||||
$block_static = new BlockedLog($db);
|
|
||||||
|
|
||||||
if($action === 'downloadblockchain') {
|
|
||||||
|
|
||||||
$auth = new BlockedLogAuthority($db);
|
|
||||||
|
|
||||||
$bc = $auth->getLocalBlockChain();
|
|
||||||
|
|
||||||
header('Content-Type: application/octet-stream');
|
|
||||||
header("Content-Transfer-Encoding: Binary");
|
|
||||||
header("Content-disposition: attachment; filename=\"" .$auth->signature. ".certif\"");
|
|
||||||
|
|
||||||
echo $bc;
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else if($action === 'downloadcsv') {
|
|
||||||
|
|
||||||
$res = $db->query("SELECT rowid,tms,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user
|
|
||||||
FROM ".MAIN_DB_PREFIX."blockedlog ORDER BY rowid ASC");
|
|
||||||
|
|
||||||
if($res) {
|
|
||||||
|
|
||||||
$signature = $block_static->getSignature();
|
|
||||||
|
|
||||||
header('Content-Type: application/octet-stream');
|
|
||||||
header("Content-Transfer-Encoding: Binary");
|
|
||||||
header("Content-disposition: attachment; filename=\"" .$signature. ".csv\"");
|
|
||||||
|
|
||||||
print $langs->transnoentities('Id')
|
|
||||||
.';'.$langs->transnoentities('Timestamp')
|
|
||||||
.';'.$langs->transnoentities('Action')
|
|
||||||
.';'.$langs->transnoentities('Amounts')
|
|
||||||
.';'.$langs->transnoentities('Element')
|
|
||||||
.';'.$langs->transnoentities('ObjectId')
|
|
||||||
.';'.$langs->transnoentities('Date')
|
|
||||||
.';'.$langs->transnoentities('Ref')
|
|
||||||
.';'.$langs->transnoentities('Fingerprint')
|
|
||||||
.';'.$langs->transnoentities('User')."\n";
|
|
||||||
|
|
||||||
while($obj = $db->fetch_object($res)) {
|
|
||||||
|
|
||||||
print $obj->rowid
|
|
||||||
.';'.$obj->tms
|
|
||||||
.';'.$obj->action
|
|
||||||
.';'.$obj->amounts
|
|
||||||
.';'.$obj->element
|
|
||||||
.';'.$obj->fk_object
|
|
||||||
.';'.$obj->date_object
|
|
||||||
.';'.$obj->ref_object
|
|
||||||
.';'.$obj->signature
|
|
||||||
.';'.$obj->fk_user."\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setEventMessage($db->lasterror, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$blocks = $block_static->getLog('all', 0, GETPOST('all') ? 0 : 50);
|
|
||||||
|
|
||||||
$form=new Form($db);
|
|
||||||
|
|
||||||
llxHeader('',$langs->trans("BlockedLogSetup"));
|
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
|
||||||
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback);
|
|
||||||
|
|
||||||
$head=blockedlogadmin_prepare_head();
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'fingerprints', '', -1);
|
|
||||||
|
|
||||||
print $langs->trans("FingerprintsDesc")."<br>\n";
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<div align="right">';
|
|
||||||
print ' <a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a>';
|
|
||||||
print ' | <a href="?all=1&showonlyerrors=1">'.$langs->trans('ShowAllFingerPrintsErrorsMightBeTooLong').'</a>';
|
|
||||||
print ' | <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a>';
|
|
||||||
print ' | <a href="?action=downloadcsv">'.$langs->trans('DownloadLogCSV').'</a>';
|
|
||||||
print ' </div>';
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
|
|
||||||
print '<td class="minwidth50">'.$langs->trans('#').'</td>';
|
|
||||||
print '<td class="center">'.$langs->trans('Date').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Author').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Action').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Ref').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Element').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Amount').'</td>';
|
|
||||||
print '<td class="center">'.$langs->trans('DataOfArchivedEvent').'</td>';
|
|
||||||
print '<td>'.$langs->trans('Fingerprint').'</td>';
|
|
||||||
print '<td><span id="blockchainstatus"></span></td>';
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
foreach($blocks as &$block) {
|
|
||||||
|
|
||||||
$checksignature = $block->checkSignature();
|
|
||||||
$object_link = $block->getObjectLink();
|
|
||||||
|
|
||||||
if(!$showonlyerrors || $block->error>0) {
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td>'.$block->id.'</td>';
|
|
||||||
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
|
|
||||||
print '<td>'.$block->getUser().'</td>';
|
|
||||||
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
|
||||||
print '<td>'.$block->ref_object.'</td>';
|
|
||||||
print '<td>'.$object_link.'</td>';
|
|
||||||
print '<td align="right">'.price($block->amounts).'</td>';
|
|
||||||
print '<td align="center"><a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
|
||||||
|
|
||||||
print '<td>';
|
|
||||||
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td>';
|
|
||||||
print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'tick') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
|
||||||
|
|
||||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
|
||||||
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$('a[rel=show-info]').click(function() {
|
|
||||||
|
|
||||||
$pop = $('<div id="pop-info"><table width="100%" class="border"><thead><th width="25%"><?php echo $langs->trans('Field') ?></th><th><?php echo $langs->trans('Value') ?></th></thead><tbody></tbody></table></div>');
|
|
||||||
|
|
||||||
$pop.dialog({
|
|
||||||
title:"<?php echo $langs->transnoentities('BlockedlogInfoDialog'); ?>"
|
|
||||||
,modal:true
|
|
||||||
,width:'80%'
|
|
||||||
});
|
|
||||||
|
|
||||||
var fk_block = $(this).attr("blockid");
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url:"../ajax/block-info.php?id="+fk_block
|
|
||||||
,dataType:'json'
|
|
||||||
}).done(function(data) {
|
|
||||||
|
|
||||||
drawData(data,'');
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function drawData(data, prefix) {
|
|
||||||
|
|
||||||
for(x in data) {
|
|
||||||
|
|
||||||
value = data[x];
|
|
||||||
|
|
||||||
$('#pop-info table tbody').append('<tr><td>'+prefix+x+'</td><td>'+value+'</td></tr>');
|
|
||||||
|
|
||||||
if( (typeof value === "object") && (value !== null) ) {
|
|
||||||
drawData(value, prefix+x+' >> ');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
|
||||||
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url : "<?php echo dol_buildpath('/blockedlog/ajax/check_signature.php',1) ?>"
|
|
||||||
,dataType:"html"
|
|
||||||
}).done(function(data) {
|
|
||||||
|
|
||||||
if(data == 'hashisok') {
|
|
||||||
$('#blockchainstatus').html('<?php echo $langs->trans('AuthorityReconizeFingerprintConformity'). ' '. img_picto($langs->trans('SignatureOK'), 'on') ?>');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('#blockchainstatus').html('<?php echo $langs->trans('AuthorityDidntReconizeFingerprintConformity'). ' '.img_picto($langs->trans('SignatureKO'), 'off') ?>');
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<br><br>';
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -45,7 +45,7 @@ $auth->syncSignatureWithAuthority();
|
|||||||
|
|
||||||
$block_static = new BlockedLog($db);
|
$block_static = new BlockedLog($db);
|
||||||
|
|
||||||
$blocks = $block_static->getLog('just_certified', 0, 0, 1) ;
|
$blocks = $block_static->getLog('just_certified', 0, 0, 'rowid', 'ASC');
|
||||||
|
|
||||||
$auth->signature = $block_static->getSignature();
|
$auth->signature = $block_static->getSignature();
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -20,76 +20,76 @@
|
|||||||
*/
|
*/
|
||||||
class BlockedLogAuthority
|
class BlockedLogAuthority
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id of the log
|
* Id of the log
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique fingerprint of the blockchain to store
|
* Unique fingerprint of the blockchain to store
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $signature = '';
|
public $signature = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entire fingerprints blockchain
|
* Entire fingerprints blockchain
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $blockchain = '';
|
public $blockchain = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* timestamp
|
* timestamp
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $tms = 0;
|
public $tms = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db) {
|
public function __construct($db) {
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the blockchain
|
* Get the blockchain
|
||||||
*
|
*
|
||||||
* @return string blockchain
|
* @return string blockchain
|
||||||
*/
|
*/
|
||||||
public function getLocalBlockChain() {
|
public function getLocalBlockChain() {
|
||||||
|
|
||||||
$block_static = new BlockedLog($this->db);
|
$block_static = new BlockedLog($this->db);
|
||||||
|
|
||||||
$this->signature = $block_static->getSignature();
|
$this->signature = $block_static->getSignature();
|
||||||
|
|
||||||
$blocks = $block_static->getLog('all', 0, 0, 1) ;
|
$blocks = $block_static->getLog('all', 0, 0, 'rowid', 'ASC') ;
|
||||||
|
|
||||||
$this->blockchain = '';
|
$this->blockchain = '';
|
||||||
|
|
||||||
foreach($blocks as &$b) {
|
foreach($blocks as &$b) {
|
||||||
$this->blockchain.=$b->signature;
|
$this->blockchain.=$b->signature;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->blockchain;
|
return $this->blockchain;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash of the block chain to check
|
* Get hash of the block chain to check
|
||||||
*
|
*
|
||||||
* @return string hash md5 of blockchain
|
* @return string hash md5 of blockchain
|
||||||
*/
|
*/
|
||||||
public function getBlockchainHash() {
|
public function getBlockchainHash() {
|
||||||
|
|
||||||
return md5($this->signature.$this->blockchain);
|
return md5($this->signature.$this->blockchain);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash of the block chain to check
|
* Get hash of the block chain to check
|
||||||
*
|
*
|
||||||
@ -97,22 +97,22 @@ class BlockedLogAuthority
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function checkBlockchain($hash) {
|
public function checkBlockchain($hash) {
|
||||||
|
|
||||||
return ($hash === $this->getBlockchainHash() );
|
return ($hash === $this->getBlockchainHash() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new block to the chain
|
* Add a new block to the chain
|
||||||
*
|
*
|
||||||
* @param string $block new block to chain
|
* @param string $block new block to chain
|
||||||
*/
|
*/
|
||||||
public function addBlock($block) {
|
public function addBlock($block) {
|
||||||
|
|
||||||
$this->blockchain.=$block;
|
$this->blockchain.=$block;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hash already exist into chain ?
|
* hash already exist into chain ?
|
||||||
*
|
*
|
||||||
@ -120,20 +120,20 @@ class BlockedLogAuthority
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function checkBlock($block) {
|
public function checkBlock($block) {
|
||||||
|
|
||||||
if(strlen($block)!=64) return false;
|
if(strlen($block)!=64) return false;
|
||||||
|
|
||||||
$blocks = str_split($this->blockchain,64);
|
$blocks = str_split($this->blockchain,64);
|
||||||
|
|
||||||
if(!in_array($block,$blocks)) {
|
if(!in_array($block,$blocks)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get object from database
|
* Get object from database
|
||||||
*
|
*
|
||||||
@ -142,40 +142,40 @@ class BlockedLogAuthority
|
|||||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||||
*/
|
*/
|
||||||
public function fetch($id, $signature='') {
|
public function fetch($id, $signature='') {
|
||||||
|
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
|
||||||
|
|
||||||
if (empty($id) && empty($signature))
|
if (empty($id) && empty($signature))
|
||||||
{
|
{
|
||||||
$this->error='BadParameter';
|
$this->error='BadParameter';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$langs->load("blockedlog");
|
$langs->load("blockedlog");
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.signature, b.blockchain, b.tms";
|
$sql = "SELECT b.rowid, b.signature, b.blockchain, b.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog_authority as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog_authority as b";
|
||||||
|
|
||||||
if ($id) $sql.= " WHERE b.rowid = ". $id;
|
if ($id) $sql.= " WHERE b.rowid = ". $id;
|
||||||
else if($signature)$sql.= " WHERE b.signature = '". $this->db->escape( $signature ) ."'" ;
|
else if($signature)$sql.= " WHERE b.signature = '". $this->db->escape( $signature ) ."'" ;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
if ($this->db->num_rows($resql))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
|
|
||||||
$this->signature = $obj->signature;
|
$this->signature = $obj->signature;
|
||||||
$this->blockchain = $obj->blockchain;
|
$this->blockchain = $obj->blockchain;
|
||||||
|
|
||||||
$this->tms = $this->db->jdate($obj->tms);
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -189,9 +189,9 @@ class BlockedLogAuthority
|
|||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create authority in database.
|
* Create authority in database.
|
||||||
*
|
*
|
||||||
@ -199,17 +199,17 @@ class BlockedLogAuthority
|
|||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function create($user) {
|
public function create($user) {
|
||||||
|
|
||||||
global $conf,$langs,$hookmanager;
|
global $conf,$langs,$hookmanager;
|
||||||
|
|
||||||
$langs->load('blockedlog');
|
$langs->load('blockedlog');
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog_authority (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog_authority (";
|
||||||
$sql.= " signature,";
|
$sql.= " signature,";
|
||||||
$sql.= " blockchain";
|
$sql.= " blockchain";
|
||||||
@ -217,18 +217,18 @@ class BlockedLogAuthority
|
|||||||
$sql.= "'".$this->db->escape($this->signature)."',";
|
$sql.= "'".$this->db->escape($this->signature)."',";
|
||||||
$sql.= "'".$this->db->escape($this->blockchain)."'";
|
$sql.= "'".$this->db->escape($this->blockchain)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."blockedlog_authority");
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."blockedlog_authority");
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -243,9 +243,9 @@ class BlockedLogAuthority
|
|||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create authority in database.
|
* Create authority in database.
|
||||||
*
|
*
|
||||||
@ -253,26 +253,26 @@ class BlockedLogAuthority
|
|||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update($user) {
|
public function update($user) {
|
||||||
|
|
||||||
global $conf,$langs,$hookmanager;
|
global $conf,$langs,$hookmanager;
|
||||||
|
|
||||||
$langs->load('blockedlog');
|
$langs->load('blockedlog');
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."blockedlog_authority SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."blockedlog_authority SET ";
|
||||||
$sql.= " blockchain='".$this->db->escape($this->blockchain)."'";
|
$sql.= " blockchain='".$this->db->escape($this->blockchain)."'";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -281,9 +281,9 @@ class BlockedLogAuthority
|
|||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For cron to sync to authority.
|
* For cron to sync to authority.
|
||||||
*
|
*
|
||||||
@ -291,43 +291,43 @@ class BlockedLogAuthority
|
|||||||
*/
|
*/
|
||||||
public function syncSignatureWithAuthority() {
|
public function syncSignatureWithAuthority() {
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
//TODO create cron task on activation
|
//TODO create cron task on activation
|
||||||
|
|
||||||
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL) || empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL) || empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||||
$this->error = $langs->trans('NoAuthorityURLDefined');
|
$this->error = $langs->trans('NoAuthorityURLDefined');
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||||
|
|
||||||
$block_static = new BlockedLog($this->db);
|
$block_static = new BlockedLog($this->db);
|
||||||
|
|
||||||
$blocks = $block_static->getLog('not_certified', 0, 0, 1);
|
$blocks = $block_static->getLog('not_certified', 0, 0, 'rowid', 'ASC');
|
||||||
|
|
||||||
$signature=$block_static->getSignature();
|
$signature=$block_static->getSignature();
|
||||||
|
|
||||||
foreach($blocks as &$block) {
|
foreach($blocks as &$block) {
|
||||||
|
|
||||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
|
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
|
||||||
|
|
||||||
$res = file_get_contents($url);
|
$res = file_get_contents($url);
|
||||||
echo $block->signature.' '.$url. ' '.$res.'<br>';
|
echo $block->signature.' '.$url. ' '.$res.'<br>';
|
||||||
if($res === 'blockalreadyadded' || $res === 'blockadded') {
|
if($res === 'blockalreadyadded' || $res === 'blockadded') {
|
||||||
|
|
||||||
$block->setCertified();
|
$block->setCertified();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$this->error = $langs->trans('ImpossibleToContactAuthority ',$url);
|
$this->error = $langs->trans('ImpossibleToContactAuthority ',$url);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -13,6 +14,8 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* See https://medium.com/@lhartikk/a-blockchain-in-200-lines-of-code-963cc1cc0e54
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +148,7 @@ class BlockedLog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object);
|
return '<i class="opacitymedium">'.$langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object).'</i>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,10 +179,20 @@ class BlockedLog
|
|||||||
* Populate properties of log from object data
|
* Populate properties of log from object data
|
||||||
*
|
*
|
||||||
* @param Object $object object to store
|
* @param Object $object object to store
|
||||||
|
* @param string $action action
|
||||||
|
* @param string $amounts amounts
|
||||||
*/
|
*/
|
||||||
public function setObjectData(&$object)
|
public function setObjectData(&$object, $action, $amounts)
|
||||||
{
|
{
|
||||||
// Set date
|
global $langs, $user, $mysoc;
|
||||||
|
|
||||||
|
// Generic fields
|
||||||
|
|
||||||
|
// action
|
||||||
|
$this->action = $action;
|
||||||
|
// amount
|
||||||
|
$this->amounts= $amounts;
|
||||||
|
// date
|
||||||
if ($object->element == 'payment' || $object->element == 'payment_supplier')
|
if ($object->element == 'payment' || $object->element == 'payment_supplier')
|
||||||
{
|
{
|
||||||
$this->date_object = $object->datepaye;
|
$this->date_object = $object->datepaye;
|
||||||
@ -191,27 +204,67 @@ class BlockedLog
|
|||||||
else {
|
else {
|
||||||
$this->date_object = $object->date;
|
$this->date_object = $object->date;
|
||||||
}
|
}
|
||||||
|
// ref
|
||||||
$this->ref_object = $object->ref;
|
$this->ref_object = ((! empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases
|
||||||
|
// type of object
|
||||||
$this->element = $object->element;
|
$this->element = $object->element;
|
||||||
|
// id of object
|
||||||
$this->fk_object = $object->id;
|
$this->fk_object = $object->id;
|
||||||
|
|
||||||
$this->object_data=new stdClass();
|
$this->object_data=new stdClass();
|
||||||
|
|
||||||
if ($this->element == 'facture')
|
// Add thirdparty info
|
||||||
|
|
||||||
|
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) $object->fetch_thirdparty();
|
||||||
|
|
||||||
|
if (! empty($object->thirdparty))
|
||||||
{
|
{
|
||||||
if(empty($object->thirdparty))$object->fetch_thirdparty();
|
|
||||||
$this->object_data->thirdparty = new stdClass();
|
$this->object_data->thirdparty = new stdClass();
|
||||||
|
|
||||||
foreach($object->thirdparty as $key=>$value) {
|
foreach($object->thirdparty as $key=>$value)
|
||||||
if(!is_object($value)) $this->object_data->thirdparty->{$key} = $value;
|
{
|
||||||
|
if (in_array($key, array('fields'))) continue; // Discard some properties
|
||||||
|
if (! in_array($key, array(
|
||||||
|
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
|
||||||
|
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||||
|
))) continue; // Discard if not into a dedicated list
|
||||||
|
if (!is_object($value)) $this->object_data->thirdparty->{$key} = $value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add company info
|
||||||
|
if (! empty($mysoc))
|
||||||
|
{
|
||||||
|
$this->object_data->mycompany = new stdClass();
|
||||||
|
|
||||||
|
foreach($mysoc as $key=>$value)
|
||||||
|
{
|
||||||
|
if (in_array($key, array('fields'))) continue; // Discard some properties
|
||||||
|
if (! in_array($key, array(
|
||||||
|
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
|
||||||
|
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||||
|
))) continue; // Discard if not into a dedicated list
|
||||||
|
if (!is_object($value)) $this->object_data->mycompany->{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add user info
|
||||||
|
|
||||||
|
$this->fk_user = $user->id;
|
||||||
|
$this->user_fullname = $user->getFullName($langs);
|
||||||
|
|
||||||
|
// Field specific to object
|
||||||
|
|
||||||
|
if ($this->element == 'facture')
|
||||||
|
{
|
||||||
$this->object_data->total_ht = (double) $object->total_ht;
|
$this->object_data->total_ht = (double) $object->total_ht;
|
||||||
$this->object_data->total_tva = (double) $object->total_tva;
|
$this->object_data->total_tva = (double) $object->total_tva;
|
||||||
$this->object_data->total_ttc = (double) $object->total_ttc;
|
$this->object_data->total_ttc = (double) $object->total_ttc;
|
||||||
$this->object_data->total_localtax1= (double) $object->total_localtax1;
|
$this->object_data->total_localtax1 = (double) $object->total_localtax1;
|
||||||
$this->object_data->total_localtax2= (double) $object->total_localtax2;
|
$this->object_data->total_localtax2 = (double) $object->total_localtax2;
|
||||||
|
|
||||||
|
$this->object_data->revenue_stamp = (double) $object->revenue_stamp;
|
||||||
|
$this->object_data->date_pointoftax = (double) $object->date_pointoftax;
|
||||||
$this->object_data->note_public = (double) $object->note_public;
|
$this->object_data->note_public = (double) $object->note_public;
|
||||||
}
|
}
|
||||||
if($this->element == 'invoice_supplier') {
|
if($this->element == 'invoice_supplier') {
|
||||||
@ -225,11 +278,12 @@ class BlockedLog
|
|||||||
$this->object_data->total_ht = (double) $object->total_ht;
|
$this->object_data->total_ht = (double) $object->total_ht;
|
||||||
$this->object_data->total_tva = (double) $object->total_tva;
|
$this->object_data->total_tva = (double) $object->total_tva;
|
||||||
$this->object_data->total_ttc = (double) $object->total_ttc;
|
$this->object_data->total_ttc = (double) $object->total_ttc;
|
||||||
$this->object_data->total_localtax1= (double) $object->total_localtax1;
|
$this->object_data->total_localtax1 = (double) $object->total_localtax1;
|
||||||
$this->object_data->total_localtax2= (double) $object->total_localtax2;
|
$this->object_data->total_localtax2 = (double) $object->total_localtax2;
|
||||||
$this->object_data->note_public = (double) $object->note_public;
|
|
||||||
$this->object_data->note_private= (double) $object->note_private;
|
|
||||||
|
|
||||||
|
$this->object_data->revenue_stamp = (double) $object->revenue_stamp;
|
||||||
|
$this->object_data->date_pointoftax = (double) $object->date_pointoftax;
|
||||||
|
$this->object_data->note_public = (double) $object->note_public;
|
||||||
}
|
}
|
||||||
elseif ($this->element == 'payment'|| $object->element == 'payment_supplier')
|
elseif ($this->element == 'payment'|| $object->element == 'payment_supplier')
|
||||||
{
|
{
|
||||||
@ -261,7 +315,7 @@ class BlockedLog
|
|||||||
|
|
||||||
$langs->load("blockedlog");
|
$langs->load("blockedlog");
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.signature, b.amounts, b.action, b.element, b.fk_object, b.certified, b.tms, b.fk_user, b.date_object, b.ref_object, b.object_data";
|
$sql = "SELECT b.rowid, b.date_creation, b.signature, b.signature_line, b.amounts, b.action, b.element, b.fk_object, b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
|
||||||
if ($id) $sql.= " WHERE b.rowid = ". $id;
|
if ($id) $sql.= " WHERE b.rowid = ". $id;
|
||||||
|
|
||||||
@ -275,7 +329,9 @@ class BlockedLog
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
|
|
||||||
$this->signature = $obj->signature;
|
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
|
|
||||||
$this->amounts = (double) $obj->amounts;
|
$this->amounts = (double) $obj->amounts;
|
||||||
$this->action = $obj->action;
|
$this->action = $obj->action;
|
||||||
$this->element = $obj->element;
|
$this->element = $obj->element;
|
||||||
@ -284,14 +340,15 @@ class BlockedLog
|
|||||||
$this->date_object = $this->db->jdate($obj->date_object);
|
$this->date_object = $this->db->jdate($obj->date_object);
|
||||||
$this->ref_object = $obj->ref_object;
|
$this->ref_object = $obj->ref_object;
|
||||||
|
|
||||||
$this->certified = ($obj->certified == 1);
|
|
||||||
|
|
||||||
$this->fk_user = $obj->fk_user;
|
$this->fk_user = $obj->fk_user;
|
||||||
|
$this->user_fullname = $obj->user_fullname;
|
||||||
$this->tms = $this->db->jdate($obj->tms);
|
|
||||||
|
|
||||||
$this->object_data = unserialize($obj->object_data);
|
$this->object_data = unserialize($obj->object_data);
|
||||||
|
|
||||||
|
$this->signature = $obj->signature;
|
||||||
|
$this->signature_line = $obj->signature_line;
|
||||||
|
$this->certified = ($obj->certified == 1);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -337,11 +394,12 @@ class BlockedLog
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
// Clean data
|
||||||
|
$this->amounts=(double) $this->amounts;
|
||||||
$this->getSignatureRecursive();
|
|
||||||
|
|
||||||
|
dol_syslog(get_class($this).'::create action='.$this->action.' fk_user='.$this->fk_user.' user_fullname='.$this->user_fullname, LOG_DEBUG);
|
||||||
|
|
||||||
|
// Check parameters/properties
|
||||||
if (is_null($this->amounts))
|
if (is_null($this->amounts))
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("BlockLogNeedAmountsValue");
|
$this->error=$langs->trans("BlockLogNeedAmountsValue");
|
||||||
@ -355,18 +413,27 @@ class BlockedLog
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($this->action)) {
|
if (empty($this->action) || empty($this->fk_user) || empty($this->user_fullname)) {
|
||||||
$this->error=$langs->trans("BlockLogNeedAction");
|
$this->error=$langs->trans("BadParameterWhenCallingCreateOfBlockedLog");
|
||||||
dol_syslog($this->error, LOG_WARNING);
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fk_user = $user->id;
|
$this->date_creation = dol_now();
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
$previoushash = $this->getPreviousHash(1); // This get last record and lock database until insert is done
|
||||||
|
|
||||||
|
$keyforsignature = $this->buildKeyForSignature();
|
||||||
|
|
||||||
|
$this->signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||||
|
$this->signature = dol_hash($previoushash . $keyforsignature, '5');
|
||||||
|
//var_dump($keyforsignature);var_dump($previoushash);var_dump($this->signature_line);var_dump($this->signature);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog (";
|
||||||
$sql.= "action,";
|
$sql.= " date_creation,";
|
||||||
|
$sql.= " action,";
|
||||||
$sql.= " amounts,";
|
$sql.= " amounts,";
|
||||||
$sql.= " signature,";
|
$sql.= " signature,";
|
||||||
$sql.= " signature_line,";
|
$sql.= " signature_line,";
|
||||||
@ -377,19 +444,22 @@ class BlockedLog
|
|||||||
$sql.= " object_data,";
|
$sql.= " object_data,";
|
||||||
$sql.= " certified,";
|
$sql.= " certified,";
|
||||||
$sql.= " fk_user,";
|
$sql.= " fk_user,";
|
||||||
|
$sql.= " user_fullname,";
|
||||||
$sql.= " entity";
|
$sql.= " entity";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
|
$sql.= "'".$this->db->idate($this->date_creation)."',";
|
||||||
$sql.= "'".$this->db->escape($this->action)."',";
|
$sql.= "'".$this->db->escape($this->action)."',";
|
||||||
$sql.= "".$this->amounts.",";
|
$sql.= $this->amounts.",";
|
||||||
$sql.= "'".$this->db->escape($this->signature)."',";
|
$sql.= "'".$this->db->escape($this->signature)."',";
|
||||||
$sql.= "'".$this->db->escape($this->signature_line)."',";
|
$sql.= "'".$this->db->escape($this->signature_line)."',";
|
||||||
$sql.= "'".$this->db->escape($this->element)."',";
|
$sql.= "'".$this->db->escape($this->element)."',";
|
||||||
$sql.= "".$this->fk_object.",";
|
$sql.= $this->fk_object.",";
|
||||||
$sql.= "'".$this->db->idate($this->date_object)."',";
|
$sql.= "'".$this->db->idate($this->date_object)."',";
|
||||||
$sql.= "'".$this->db->escape($this->ref_object)."',";
|
$sql.= "'".$this->db->escape($this->ref_object)."',";
|
||||||
$sql.= "'".$this->db->escape(serialize($this->object_data))."',";
|
$sql.= "'".$this->db->escape(serialize($this->object_data))."',";
|
||||||
$sql.= "0,";
|
$sql.= "0,";
|
||||||
$sql.= "".$user->id.",";
|
$sql.= $this->fk_user.",";
|
||||||
|
$sql.= "'".$this->db->escape($this->user_fullname)."',";
|
||||||
$sql.= $conf->entity;
|
$sql.= $conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
@ -419,93 +489,120 @@ class BlockedLog
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The commit will release the lock so we can insert nex record
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return crypted value.
|
* Check if current signature still correct compare to the chain
|
||||||
*
|
*
|
||||||
* @param string $value string to crypt
|
* @return boolean True if OK, False if KO
|
||||||
* @return string crypted string
|
|
||||||
*/
|
*/
|
||||||
private function crypt($value) {
|
public function checkSignature()
|
||||||
|
{
|
||||||
|
|
||||||
return hash('sha256',$value);
|
//$oldblockedlog = new BlockedLog($this->db);
|
||||||
|
//$previousrecord = $oldblockedlog->fetch($this->id - 1);
|
||||||
|
$previoushash = $this->getPreviousHash(0, $this->id);
|
||||||
|
|
||||||
}
|
// Recalculate hash
|
||||||
|
$keyforsignature = $this->buildKeyForSignature();
|
||||||
|
$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||||
|
$signature = dol_hash($previoushash . $keyforsignature, '5');
|
||||||
|
//var_dump($previoushash); var_dump($keyforsignature); var_dump($signature_line); var_dump($signature);
|
||||||
|
|
||||||
/**
|
$res = ($signature === $this->signature);
|
||||||
* check if current signature still correct compare to the chain
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function checkSignature() {
|
|
||||||
|
|
||||||
$signature_to_test = $this->signature;
|
if (!$res) {
|
||||||
|
$this->error = 'Signature KO';
|
||||||
$this->getSignatureRecursive();
|
|
||||||
|
|
||||||
$res = ($signature_to_test === $this->signature);
|
|
||||||
|
|
||||||
if(!$res) {
|
|
||||||
$this->error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set current signatures
|
* Return a string for signature
|
||||||
|
*
|
||||||
|
* @return string Key for signature
|
||||||
*/
|
*/
|
||||||
private function getSignatureRecursive(){
|
private function buildKeyForSignature()
|
||||||
|
{
|
||||||
|
//print_r($this->object_data);
|
||||||
|
return $this->date_creation.'|'.$this->action.'|'.$this->amounts.'|'.$this->ref_object.'|'.$this->date_object.'|'.$this->user_fullname.'|'.print_r($this->object_data, true);
|
||||||
|
}
|
||||||
|
|
||||||
$this->signature_line = $this->crypt( $this->action . $this->getSignature() . $this->amounts . print_r($this->object_data, true) );
|
|
||||||
/*if($this->signature=='d6320580a02c1ab67fcc0a6d49d453c7d96dda0148901736f7f55725bfe1b900' || $this->signature=='ea65d435ff12ca929936a406aa9d707d99fb334c127878d256b602a5541bbbc9') {
|
|
||||||
var_dump($this->signature_line,$this->action ,$this->getSignature() , $this->amounts , $this->object_data);
|
|
||||||
}*/
|
|
||||||
$this->signature = $this->signature_line;
|
|
||||||
|
|
||||||
$logs = $this->getLog('all', 0, 0, 1) ;
|
/**
|
||||||
if($logs!==false) {
|
* Get previous signature/hash in chain
|
||||||
foreach($logs as &$b) {
|
*
|
||||||
|
* @param int $withlock 1=With a lock
|
||||||
|
* @param int $beforeid Before id
|
||||||
|
* @return string Hash of last record
|
||||||
|
*/
|
||||||
|
private function getPreviousHash($withlock=0, $beforeid=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
if($this->id>0 && $b->id == $this->id) break; // on arrête sur un enregistrement précis pour recalculer une signature
|
$previoussignature='';
|
||||||
|
|
||||||
$b->getCurrentValue(); // on récupère la valeur actuelle en base de l'élément enregistré
|
$sql="SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity;
|
||||||
|
if ($beforeid) $sql.= " AND rowid < ".(int) $beforeid;
|
||||||
|
$sql.=" ORDER BY rowid DESC LIMIT 1";
|
||||||
|
$sql.=($withlock ? " FOR UPDATE ": "");
|
||||||
|
|
||||||
$this->signature = $this->crypt($this->signature. $this->action . $b->signature . $b->amounts);
|
$resql = $this->db->query($sql);
|
||||||
}
|
if ($resql) {
|
||||||
}
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($obj)
|
||||||
|
{
|
||||||
|
$previoussignature = $obj->signature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($previoussignature))
|
||||||
|
{
|
||||||
|
// First signature line (line 0)
|
||||||
|
$previoussignature = $this->getSignature();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $previoussignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return log object for a element.
|
* Return array of log objects (with criterias)
|
||||||
*
|
*
|
||||||
* @param string $element element to search
|
* @param string $element element to search
|
||||||
* @param int $fk_object id of object to search
|
* @param int $fk_object id of object to search
|
||||||
* @param int $limit max number of element, 0 for all
|
* @param int $limit max number of element, 0 for all
|
||||||
* @param string $order sort of query
|
* @param string $sortfield sort field
|
||||||
|
* @param string $sortorder sort order
|
||||||
|
* @param int $search_start start time limit
|
||||||
|
* @param int $search_end end time limit
|
||||||
* @return array array of object log
|
* @return array array of object log
|
||||||
*/
|
*/
|
||||||
public function getLog($element, $fk_object, $limit = 0, $order = -1) {
|
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_start = -1, $search_end = -1)
|
||||||
global $conf,$cachedlogs ;
|
{
|
||||||
|
global $conf, $cachedlogs;
|
||||||
|
|
||||||
/* $cachedlogs allow fastest search */
|
/* $cachedlogs allow fastest search */
|
||||||
if(empty($cachedlogs)) $cachedlogs=array();
|
if (empty($cachedlogs)) $cachedlogs=array();
|
||||||
|
|
||||||
|
if ($element=='all') {
|
||||||
if($element=='all') {
|
|
||||||
|
|
||||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||||
WHERE entity=".$conf->entity;
|
WHERE entity=".$conf->entity;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if($element=='not_certified') {
|
else if ($element=='not_certified') {
|
||||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||||
WHERE entity=".$conf->entity." AND certified = 0";
|
WHERE entity=".$conf->entity." AND certified = 0";
|
||||||
|
|
||||||
}
|
}
|
||||||
else if($element=='just_certified') {
|
else if ($element=='just_certified') {
|
||||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||||
WHERE entity=".$conf->entity." AND certified = 1";
|
WHERE entity=".$conf->entity." AND certified = 1";
|
||||||
|
|
||||||
@ -513,10 +610,12 @@ class BlockedLog
|
|||||||
else{
|
else{
|
||||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||||
WHERE element='".$element."' AND fk_object=".(int) $fk_object;
|
WHERE element='".$element."' AND fk_object=".(int) $fk_object;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.=($order<0 ? ' ORDER BY rowid DESC ' : ' ORDER BY rowid ASC ');
|
if($search_start > 0) $sql.=" AND date_creation >= '".$this->db->idate($search_start)."'";
|
||||||
|
if($search_end > 0) $sql.=" AND date_creation <= '".$this->db->idate($search_end)."'";
|
||||||
|
|
||||||
|
$sql.=$this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
if($limit > 0 )$sql.=' LIMIT '.$limit;
|
if($limit > 0 )$sql.=' LIMIT '.$limit;
|
||||||
|
|
||||||
@ -526,9 +625,9 @@ class BlockedLog
|
|||||||
|
|
||||||
$results=array();
|
$results=array();
|
||||||
|
|
||||||
while($obj = $this->db->fetch_object($res)) {
|
while ($obj = $this->db->fetch_object($res)) {
|
||||||
|
|
||||||
if(!isset($cachedlogs[$obj->rowid])) {
|
if (!isset($cachedlogs[$obj->rowid])) {
|
||||||
$b=new BlockedLog($this->db);
|
$b=new BlockedLog($this->db);
|
||||||
$b->fetch($obj->rowid);
|
$b->fetch($obj->rowid);
|
||||||
|
|
||||||
@ -536,7 +635,6 @@ class BlockedLog
|
|||||||
}
|
}
|
||||||
|
|
||||||
$results[] = $cachedlogs[$obj->rowid];
|
$results[] = $cachedlogs[$obj->rowid];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
@ -547,52 +645,19 @@ class BlockedLog
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set amounts of log from current element value in order to compare signature.
|
* Return the signature (hash) of the "genesis-block" (Block 0)
|
||||||
*/
|
|
||||||
private function getCurrentValue() {
|
|
||||||
|
|
||||||
if($this->element === 'payment') {
|
|
||||||
$sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiement WHERE rowid=".$this->fk_object;
|
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
|
||||||
|
|
||||||
if($res && $obj = $this->db->fetch_object($res)) {
|
|
||||||
$this->amounts = (double) $obj->amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($this->element === 'payment_supplier') {
|
|
||||||
$sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiementfourn WHERE rowid=".$this->fk_object;
|
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
|
||||||
|
|
||||||
if($res && $obj = $this->db->fetch_object($res)) {
|
|
||||||
$this->amounts = (double) $obj->amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif($this->element === 'facture') {
|
|
||||||
$sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object;
|
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
|
||||||
if($res && $obj = $this->db->fetch_object($res)) {
|
|
||||||
$this->amounts = (double) $obj->total_ttc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return and set the entity signature included into line signature
|
|
||||||
*
|
*
|
||||||
* @return string current entity signature
|
* @return string Signature of genesis-block for current conf->entity
|
||||||
*/
|
*/
|
||||||
public function getSignature() {
|
public function getSignature()
|
||||||
|
{
|
||||||
global $db,$conf,$mysoc;
|
global $db,$conf,$mysoc;
|
||||||
|
|
||||||
if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
|
if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
|
||||||
$fingerprint = $this->crypt(print_r($mysoc,true).time().rand(0,1000));
|
$fingerprint = dol_hash(print_r($mysoc,true).getRandomPassword(1), '5');
|
||||||
|
|
||||||
dolibarr_set_const($db, 'BLOCKEDLOG_ENTITY_FINGERPRINT', $fingerprint, 'chaine',0,'Numeric Unique Fingerprint', $conf->entity);
|
dolibarr_set_const($db, 'BLOCKEDLOG_ENTITY_FINGERPRINT', $fingerprint, 'chaine',0,'Numeric Unique Fingerprint', $conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ function blockedlogadmin_prepare_head()
|
|||||||
$head[$h][2] = 'blockedlog';
|
$head[$h][2] = 'blockedlog';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/fingerprints.php";
|
$head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/blockedlog_list.php";
|
||||||
$head[$h][1] = $langs->trans("Fingerprints");
|
$head[$h][1] = $langs->trans("Fingerprints");
|
||||||
$head[$h][2] = 'fingerprints';
|
$head[$h][2] = 'fingerprints';
|
||||||
$h++;
|
$h++;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
$db = $aDb;
|
$db = $aDb;
|
||||||
$langs = $aLangs;
|
$langs = $aLangs;
|
||||||
|
|
||||||
$ret.= '<div class="menu_top"></div>'."\n";
|
$ret = '<div class="menu_top"></div>'."\n";
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
|
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
|
||||||
|
|
||||||
@ -67,22 +67,23 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = '';
|
|
||||||
|
|
||||||
// Menu bookmark
|
// Menu bookmark
|
||||||
$ret.= '<div class="menu_top"></div>'."\n";
|
$ret = '<div class="menu_top"></div>'."\n";
|
||||||
|
|
||||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
||||||
|
$ret.= ' html="'.dol_escape_htmltag('<span class="fa fa-star-o"></span> '.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
||||||
|
$ret.= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||||
// Url to go on create new bookmark page
|
// Url to go on create new bookmark page
|
||||||
if (! empty($user->rights->bookmark->creer))
|
if (! empty($user->rights->bookmark->creer))
|
||||||
{
|
{
|
||||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
|
||||||
|
$ret.= ' html="'.dol_escape_htmltag('<span class="fa fa-star-o"></span> '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
|
||||||
}
|
}
|
||||||
// Menu with all bookmarks
|
// Menu with all bookmarks
|
||||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||||
@ -96,9 +97,9 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">';
|
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'"';
|
||||||
//$ret.='<span class="fa fa-print">aa</span>';
|
//$ret.=' html="'.dol_escape_htmltag('<span class="fa fa-print"></span> '.$obj->title).'"';
|
||||||
$ret.=img_picto('','object_bookmark').' ';
|
$ret.='>';
|
||||||
$ret.=dol_escape_htmltag($obj->title);
|
$ret.=dol_escape_htmltag($obj->title);
|
||||||
$ret.='</option>';
|
$ret.='</option>';
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -107,9 +107,9 @@ if ($resql)
|
|||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
//print "<td> </td>";
|
//print "<td> </td>";
|
||||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"rowid","", $param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"b.rowid","", $param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"b.title","", $param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Link",'','');
|
print_liste_field_titre("Link",$_SERVER["PHP_SELF"],"b.url","", $param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Target",'','','','','align="center"');
|
print_liste_field_titre("Target",'','','','','align="center"');
|
||||||
print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
|
||||||
|
|||||||
@ -114,10 +114,13 @@ switch($action)
|
|||||||
{
|
{
|
||||||
if (count($prodcustprice->lines) > 0)
|
if (count($prodcustprice->lines) > 0)
|
||||||
{
|
{
|
||||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||||
$tva_tx = $prodcustprice->lines [0]->tva_tx;
|
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||||
|
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||||
|
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
|
||||||
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -217,10 +217,14 @@ class Categories extends DolibarrApi
|
|||||||
$this->category->$field = $value;
|
$this->category->$field = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->category->update(DolibarrApiAccess::$user))
|
if ($this->category->update(DolibarrApiAccess::$user) > 0)
|
||||||
|
{
|
||||||
return $this->get ($id);
|
return $this->get ($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $this->task->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,492 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Luracast\Restler\RestException;
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* API class for category object
|
|
||||||
*
|
|
||||||
* @smart-auto-routing false
|
|
||||||
* @access protected
|
|
||||||
* @class DolibarrApiAccess {@requires user,external}
|
|
||||||
*
|
|
||||||
* @deprecated Use Categories instead (defined in api_categories.class.php)
|
|
||||||
*/
|
|
||||||
class CategoryApi extends DolibarrApi
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
|
||||||
*/
|
|
||||||
static $FIELDS = array(
|
|
||||||
'label',
|
|
||||||
'type'
|
|
||||||
);
|
|
||||||
|
|
||||||
static $TYPES = array(
|
|
||||||
0 => 'product',
|
|
||||||
1 => 'supplier',
|
|
||||||
2 => 'customer',
|
|
||||||
3 => 'member',
|
|
||||||
4 => 'contact',
|
|
||||||
5 => 'account',
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Categorie $category {@type Categorie}
|
|
||||||
*/
|
|
||||||
public $category;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @url GET category/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
global $db, $conf;
|
|
||||||
$this->db = $db;
|
|
||||||
$this->category = new Categorie($this->db);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get properties of a category object <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* Return an array with category informations
|
|
||||||
*
|
|
||||||
* @param int $id ID of category
|
|
||||||
* @return array|mixed data without useless information
|
|
||||||
*
|
|
||||||
* @url GET category/{id}
|
|
||||||
* @throws RestException
|
|
||||||
*/
|
|
||||||
function get($id)
|
|
||||||
{
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->category->fetch($id);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'category not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('category',$this->category->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->category);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List categories <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* Get a list of categories
|
|
||||||
*
|
|
||||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
* @return array Array of category objects
|
|
||||||
*
|
|
||||||
* @url GET /category/list
|
|
||||||
*/
|
|
||||||
function getList($type='product', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
global $db, $conf;
|
|
||||||
|
|
||||||
$obj_ret = array();
|
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT s.rowid";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
|
||||||
$sql.= ' WHERE s.entity IN ('.getEntity('category').')';
|
|
||||||
$sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES);
|
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
||||||
{
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
|
||||||
if ($limit) {
|
|
||||||
if ($page < 0)
|
|
||||||
{
|
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $limit * $page;
|
|
||||||
|
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$i=0;
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
|
||||||
while ($i < $min)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$category_static = new Categorie($db);
|
|
||||||
if($category_static->fetch($obj->rowid)) {
|
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($category_static);
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror());
|
|
||||||
}
|
|
||||||
if( ! count($obj_ret)) {
|
|
||||||
throw new RestException(404, 'No category found');
|
|
||||||
}
|
|
||||||
return $obj_ret;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* List categories of an entity <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* Get a list of categories
|
|
||||||
*
|
|
||||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
* @param int $item Id of the item to get categories for
|
|
||||||
* @return array Array of category objects
|
|
||||||
*
|
|
||||||
* @url GET /product/{item}/categories
|
|
||||||
*/
|
|
||||||
function getListForItem($type='product', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $item = 0) {
|
|
||||||
global $db, $conf;
|
|
||||||
|
|
||||||
$obj_ret = array();
|
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
//if ($type == "") {
|
|
||||||
//$type="product";
|
|
||||||
//}
|
|
||||||
$sub_type = $type;
|
|
||||||
$subcol_name = "fk_".$type;
|
|
||||||
if ($type=="customer" || $type=="supplier") {
|
|
||||||
$sub_type="societe";
|
|
||||||
$subcol_name="fk_soc";
|
|
||||||
}
|
|
||||||
$sql = "SELECT s.rowid";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
|
||||||
$sql.= ' WHERE s.entity IN ('.getEntity('category').')';
|
|
||||||
$sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES);
|
|
||||||
$sql.= ' AND s.rowid = sub.fk_categorie';
|
|
||||||
$sql.= ' AND sub.'.$subcol_name.' = '.$item;
|
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
||||||
{
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
|
||||||
if ($limit) {
|
|
||||||
if ($page < 0)
|
|
||||||
{
|
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $limit * $page;
|
|
||||||
|
|
||||||
$sql.= $db->plimit($limit + 1, $offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$i=0;
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
|
||||||
while ($i < $min)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$category_static = new Categorie($db);
|
|
||||||
if($category_static->fetch($obj->rowid)) {
|
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($category_static);
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror());
|
|
||||||
}
|
|
||||||
if( ! count($obj_ret)) {
|
|
||||||
throw new RestException(404, 'No category found');
|
|
||||||
}
|
|
||||||
return $obj_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get member categories list <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /category/list/member
|
|
||||||
*/
|
|
||||||
function getListCategoryMember($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
return $this->getList('member', $sortfield, $sortorder, $limit, $page);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get customer categories list <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /category/list/customer
|
|
||||||
*/
|
|
||||||
function getListCategoryCustomer($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
return $this->getList('customer', $sortfield, $sortorder, $limit, $page);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get categories for a customer <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param int $cusid Customer id filter
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /customer/{cusid}/categories
|
|
||||||
*/
|
|
||||||
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
return $this->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $cusid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add category to customer <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param int $cusid Id of customer
|
|
||||||
* @param int $catid Id of category
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /customer/{cusid}/addCategory/{catid}
|
|
||||||
*/
|
|
||||||
function addCustomerCategory($cusid,$catid) {
|
|
||||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
$customer = new Client($this->db);
|
|
||||||
$customer->fetch($cusid);
|
|
||||||
if( ! $customer ) {
|
|
||||||
throw new RestException(404, 'customer not found');
|
|
||||||
}
|
|
||||||
$result = $this->category->fetch($catid);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'category not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('societe',$customer->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('category',$this->category->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
$this->category->add_type($customer,'customer');
|
|
||||||
return $customer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get supplier categories list <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /category/list/supplier
|
|
||||||
*/
|
|
||||||
function getListCategorySupplier($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
return $this->getList('supplier', $sortfield, $sortorder, $limit, $page);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get product categories list <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /category/list/product
|
|
||||||
*/
|
|
||||||
function getListCategoryProduct($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
return $this->getList('product', $sortfield, $sortorder, $limit, $page);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get contact categories list <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param string $sortfield Sort field
|
|
||||||
* @param string $sortorder Sort order
|
|
||||||
* @param int $limit Limit for list
|
|
||||||
* @param int $page Page number
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @url GET /category/list/contact
|
|
||||||
*/
|
|
||||||
function getListCategoryContact($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
|
||||||
return $this->getList('contact', $sortfield, $sortorder, $limit, $page);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create category object <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param array $request_data Request data
|
|
||||||
* @return int ID of category
|
|
||||||
*
|
|
||||||
* @url POST category/
|
|
||||||
*/
|
|
||||||
function post($request_data = NULL)
|
|
||||||
{
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
// Check mandatory fields
|
|
||||||
$result = $this->_validate($request_data);
|
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
|
||||||
$this->category->$field = $value;
|
|
||||||
}
|
|
||||||
if($this->category->create(DolibarrApiAccess::$user) < 0) {
|
|
||||||
throw new RestException(500, 'Error when create category : '.$this->category->error);
|
|
||||||
}
|
|
||||||
return $this->category->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update category <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param int $id Id of category to update
|
|
||||||
* @param array $request_data Datas
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @url PUT category/{id}
|
|
||||||
*/
|
|
||||||
function put($id, $request_data = NULL)
|
|
||||||
{
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->creer) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->category->fetch($id);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'category not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('category',$this->category->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($request_data as $field => $value) {
|
|
||||||
if ($field == 'id') continue;
|
|
||||||
$this->category->$field = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->category->update(DolibarrApiAccess::$user))
|
|
||||||
return $this->get ($id);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete category <b>Warning: Deprecated</b>
|
|
||||||
*
|
|
||||||
* @param int $id Category ID
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @url DELETE category/{id}
|
|
||||||
*/
|
|
||||||
function delete($id)
|
|
||||||
{
|
|
||||||
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
$result = $this->category->fetch($id);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'category not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('category',$this->category->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $this->category->delete(DolibarrApiAccess::$user)) {
|
|
||||||
throw new RestException(401,'error when delete category');
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'success' => array(
|
|
||||||
'code' => 200,
|
|
||||||
'message' => 'Category deleted'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate fields before create or update object
|
|
||||||
*
|
|
||||||
* @param array|null $data Data to validate
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @throws RestException
|
|
||||||
*/
|
|
||||||
function _validate($data)
|
|
||||||
{
|
|
||||||
$category = array();
|
|
||||||
foreach (CategoryApi::$FIELDS as $field) {
|
|
||||||
if (!isset($data[$field]))
|
|
||||||
throw new RestException(400, "$field field missing");
|
|
||||||
$category[$field] = $data[$field];
|
|
||||||
}
|
|
||||||
return $category;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -392,7 +392,7 @@ class Categorie extends CommonObject
|
|||||||
* -1 : SQL error
|
* -1 : SQL error
|
||||||
* -2 : invalid category
|
* -2 : invalid category
|
||||||
*/
|
*/
|
||||||
function update($user='')
|
function update(User $user)
|
||||||
{
|
{
|
||||||
global $conf, $langs,$hookmanager;
|
global $conf, $langs,$hookmanager;
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ $langs->load("agenda");
|
|||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$cancel=GETPOST('cancel','alpha');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
$backtopage=GETPOST('backtopage','alpha');
|
$backtopage=GETPOST('backtopage','alpha');
|
||||||
$contactid=GETPOST('contactid','int');
|
$socpeopleassigned=GETPOST('socpeopleassigned','array');
|
||||||
$origin=GETPOST('origin','alpha');
|
$origin=GETPOST('origin','alpha');
|
||||||
$originid=GETPOST('originid','int');
|
$originid=GETPOST('originid','int');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
@ -133,7 +133,7 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
|
|||||||
{
|
{
|
||||||
$assignedtouser=json_decode($_SESSION['assignedtouser'], true);
|
$assignedtouser=json_decode($_SESSION['assignedtouser'], true);
|
||||||
}
|
}
|
||||||
$assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1);
|
$assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'), 'mandatory'=>1);
|
||||||
$_SESSION['assignedtouser']=json_encode($assignedtouser);
|
$_SESSION['assignedtouser']=json_encode($assignedtouser);
|
||||||
}
|
}
|
||||||
$donotclearsession=1;
|
$donotclearsession=1;
|
||||||
@ -185,9 +185,9 @@ if ($action == 'add')
|
|||||||
else $backtopage=DOL_URL_ROOT.'/comm/action/index.php';
|
else $backtopage=DOL_URL_ROOT.'/comm/action/index.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contactid)
|
if (!empty($socpeopleassigned[0]))
|
||||||
{
|
{
|
||||||
$result=$contact->fetch($contactid);
|
$result=$contact->fetch($socpeopleassigned[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cancel)
|
if ($cancel)
|
||||||
@ -316,6 +316,16 @@ if ($action == 'add')
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($socpeopleassigned as $cid)
|
||||||
|
{
|
||||||
|
$object->socpeopleassigned[$cid] = array('id' => $cid);
|
||||||
|
}
|
||||||
|
if (!empty($object->socpeopleassigned))
|
||||||
|
{
|
||||||
|
reset($object->socpeopleassigned);
|
||||||
|
$object->contactid = key($object->socpeopleassigned);
|
||||||
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
@ -406,6 +416,8 @@ if ($action == 'update')
|
|||||||
$object->fulldayevent= GETPOST("fullday")?1:0;
|
$object->fulldayevent= GETPOST("fullday")?1:0;
|
||||||
$object->location = GETPOST('location');
|
$object->location = GETPOST('location');
|
||||||
$object->socid = GETPOST("socid");
|
$object->socid = GETPOST("socid");
|
||||||
|
$socpeopleassigned = GETPOST("socpeopleassigned",'array');
|
||||||
|
foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid);
|
||||||
$object->contactid = GETPOST("contactid",'int');
|
$object->contactid = GETPOST("contactid",'int');
|
||||||
$object->fk_project = GETPOST("projectid",'int');
|
$object->fk_project = GETPOST("projectid",'int');
|
||||||
$object->note = GETPOST("note");
|
$object->note = GETPOST("note");
|
||||||
@ -427,7 +439,7 @@ if ($action == 'update')
|
|||||||
if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users
|
if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users
|
||||||
{
|
{
|
||||||
// Restore array with key with same value than param 'id'
|
// Restore array with key with same value than param 'id'
|
||||||
$tmplist1=json_decode($_SESSION['assignedtouser'], true); $tmplist2=array();
|
$tmplist1=json_decode($_SESSION['assignedtouser'], true);
|
||||||
foreach($tmplist1 as $key => $val)
|
foreach($tmplist1 as $key => $val)
|
||||||
{
|
{
|
||||||
if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
|
if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
|
||||||
@ -437,7 +449,6 @@ if ($action == 'update')
|
|||||||
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
|
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
|
||||||
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
|
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->userassigned=array(); $object->userownerid=0; // Clear old content
|
$object->userassigned=array(); $object->userownerid=0; // Clear old content
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($listofuserid as $key => $val)
|
foreach($listofuserid as $key => $val)
|
||||||
@ -448,6 +459,7 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$object->transparency = $transparency; // We set transparency on event (even if we can also store it on each user, standard says this property is for event)
|
$object->transparency = $transparency; // We set transparency on event (even if we can also store it on each user, standard says this property is for event)
|
||||||
|
// TODO store also transparency on owner user
|
||||||
|
|
||||||
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||||
{
|
{
|
||||||
@ -533,8 +545,9 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Action move update, used when user move an event in calendar by drag'n drop
|
* Action move update, used when user move an event in calendar by drag'n drop
|
||||||
|
* TODO Move this into page comm/action/index that trigger this call by the drag and drop of event.
|
||||||
*/
|
*/
|
||||||
if ($action == 'mupdate')
|
if (GETPOST('actionmove','alpha') == 'mupdate')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_userassigned();
|
$object->fetch_userassigned();
|
||||||
@ -545,7 +558,7 @@ if ($action == 'mupdate')
|
|||||||
$newdate=GETPOST('newdate','alpha');
|
$newdate=GETPOST('newdate','alpha');
|
||||||
if (empty($newdate) || strpos($newdate,'dayevent_') != 0 )
|
if (empty($newdate) || strpos($newdate,'dayevent_') != 0 )
|
||||||
{
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,9 +607,10 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
|
|
||||||
if (GETPOST("contactid"))
|
$socpeopleassigned = GETPOST("socpeopleassigned", 'array');
|
||||||
|
if (!empty($socpeopleassigned[0]))
|
||||||
{
|
{
|
||||||
$result=$contact->fetch(GETPOST("contactid"));
|
$result=$contact->fetch($socpeopleassigned[0]);
|
||||||
if ($result < 0) dol_print_error($db,$contact->error);
|
if ($result < 0) dol_print_error($db,$contact->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,6 +709,62 @@ if ($action == 'create')
|
|||||||
else $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
else $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress
|
||||||
|
if ($userepeatevent)
|
||||||
|
{
|
||||||
|
// Repeat
|
||||||
|
print '<tr><td>'.$langs->trans("RepeatEvent").'</td><td colspan="3">';
|
||||||
|
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
|
||||||
|
$arrayrecurrulefreq=array(
|
||||||
|
'no'=>$langs->trans("No"),
|
||||||
|
'MONTHLY'=>$langs->trans("EveryMonth"),
|
||||||
|
'WEEKLY'=>$langs->trans("EveryWeek"),
|
||||||
|
//'DAYLY'=>$langs->trans("EveryDay")
|
||||||
|
);
|
||||||
|
$selectedrecurrulefreq='no';
|
||||||
|
$selectedrecurrulebymonthday='';
|
||||||
|
$selectedrecurrulebyday='';
|
||||||
|
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i',$object->recurrule,$reg)) $selectedrecurrulefreq=$reg[1];
|
||||||
|
if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY=(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebymonthday=$reg[1];
|
||||||
|
if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebyday=$reg[1];
|
||||||
|
print $form->selectarray('recurrulefreq', $arrayrecurrulefreq, $selectedrecurrulefreq, 0, 0, 0, '', 0, 0, 0, '', 'marginrightonly');
|
||||||
|
// If recurrulefreq is MONTHLY
|
||||||
|
print '<div class="hidden marginrightonly inline-block repeateventBYMONTHDAY">';
|
||||||
|
print $langs->trans("DayOfMonth").': <input type="input" size="2" name="BYMONTHDAY" value="'.$selectedrecurrulebymonthday.'">';
|
||||||
|
print '</div>';
|
||||||
|
// If recurrulefreq is WEEKLY
|
||||||
|
print '<div class="hidden marginrightonly inline-block repeateventBYDAY">';
|
||||||
|
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
|
||||||
|
print '</div>';
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function init_repeat()
|
||||||
|
{
|
||||||
|
if (jQuery("#recurrulefreq").val() == \'MONTHLY\')
|
||||||
|
{
|
||||||
|
jQuery(".repeateventBYMONTHDAY").css("display", "inline-block"); /* use this instead of show because we want inline-block and not block */
|
||||||
|
jQuery(".repeateventBYDAY").hide();
|
||||||
|
}
|
||||||
|
else if (jQuery("#recurrulefreq").val() == \'WEEKLY\')
|
||||||
|
{
|
||||||
|
jQuery(".repeateventBYMONTHDAY").hide();
|
||||||
|
jQuery(".repeateventBYDAY").css("display", "inline-block"); /* use this instead of show because we want inline-block and not block */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jQuery(".repeateventBYMONTHDAY").hide();
|
||||||
|
jQuery(".repeateventBYDAY").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_repeat();
|
||||||
|
jQuery("#recurrulefreq").change(function() {
|
||||||
|
init_repeat();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -712,7 +782,7 @@ if ($action == 'create')
|
|||||||
// Location
|
// Location
|
||||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth100" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="soixantepercent" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assigned to
|
// Assigned to
|
||||||
@ -722,6 +792,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
|
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
|
||||||
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first
|
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first
|
||||||
|
$listofuserid[$user->id]['transparency']=GETPOSTISSET('transparency')?GETPOST('transparency','alpha'):1; // 1 by default at first init
|
||||||
$_SESSION['assignedtouser']=json_encode($listofuserid);
|
$_SESSION['assignedtouser']=json_encode($listofuserid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -730,16 +801,17 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$listofuserid=json_decode($_SESSION['assignedtouser'], true);
|
$listofuserid=json_decode($_SESSION['assignedtouser'], true);
|
||||||
}
|
}
|
||||||
|
$listofuserid[$user->id]['transparency']=GETPOSTISSET('transparency')?GETPOST('transparency','alpha'):0; // 0 by default when refreshing
|
||||||
}
|
}
|
||||||
print '<div class="assignedtouser">';
|
print '<div class="assignedtouser">';
|
||||||
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
|
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
if (in_array($user->id,array_keys($listofuserid)))
|
/*if (in_array($user->id,array_keys($listofuserid)))
|
||||||
{
|
{
|
||||||
print '<div class="myavailability">';
|
print '<div class="myavailability">';
|
||||||
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked':'').'> '.$langs->trans("Busy");
|
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked':'').'> '.$langs->trans("Busy");
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}*/
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Realised by
|
// Realised by
|
||||||
@ -751,39 +823,45 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br><br>';
|
|
||||||
|
|
||||||
|
print '<br><hr><br>';
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Related company
|
if ($conf->societe->enabled)
|
||||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
|
||||||
if (GETPOST('socid','int') > 0)
|
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
// Related company
|
||||||
$societe->fetch(GETPOST('socid','int'));
|
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||||
print $societe->getNomUrl(1);
|
if (GETPOST('socid','int') > 0)
|
||||||
print '<input type="hidden" id="socid" name="socid" value="'.GETPOST('socid','int').'">';
|
{
|
||||||
}
|
$societe = new Societe($db);
|
||||||
else
|
$societe->fetch(GETPOST('socid','int'));
|
||||||
{
|
print $societe->getNomUrl(1);
|
||||||
$events=array();
|
print '<input type="hidden" id="socid" name="socid" value="'.GETPOST('socid','int').'">';
|
||||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
|
||||||
//For external user force the company to user company
|
|
||||||
if (!empty($user->societe_id)) {
|
|
||||||
print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events);
|
|
||||||
} else {
|
|
||||||
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$events=array();
|
||||||
|
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||||
|
//For external user force the company to user company
|
||||||
|
if (!empty($user->societe_id)) {
|
||||||
|
print $form->select_company($user->societe_id, 'socid', '', 1, 1, 0, $events, 0, 'minwidth300');
|
||||||
|
} else {
|
||||||
|
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Related contact
|
||||||
|
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
|
||||||
|
$preselectedids=GETPOST('socpeopleassigned', 'array');
|
||||||
|
if (GETPOST('contactid','int')) $preselectedids[GETPOST('contactid','int')]=GETPOST('contactid','int');
|
||||||
|
print $form->selectcontacts(GETPOST('socid','int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Related contact
|
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
|
|
||||||
$form->selectcontacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth200');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
@ -791,7 +869,7 @@ if ($action == 'create')
|
|||||||
// Projet associe
|
// Projet associe
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
|
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
|
||||||
if ($numproject==0)
|
if ($numproject==0)
|
||||||
@ -803,7 +881,7 @@ if ($action == 'create')
|
|||||||
if (!empty($origin) && !empty($originid))
|
if (!empty($origin) && !empty($originid))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
print '<tr><td>'.$langs->trans("LinkedObject").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
|
||||||
print '<td colspan="3">'.dolGetElementUrl($originid,$origin,1).'</td></tr>';
|
print '<td colspan="3">'.dolGetElementUrl($originid,$origin,1).'</td></tr>';
|
||||||
print '<input type="hidden" name="fk_element" size="10" value="'.GETPOST('originid').'">';
|
print '<input type="hidden" name="fk_element" size="10" value="'.GETPOST('originid').'">';
|
||||||
print '<input type="hidden" name="elementtype" size="10" value="'.GETPOST('origin').'">';
|
print '<input type="hidden" name="elementtype" size="10" value="'.GETPOST('origin').'">';
|
||||||
@ -817,14 +895,14 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Priority
|
// Priority
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||||
print '<input type="text" name="priority" value="'.(GETPOST('priority')?GETPOST('priority'):($object->priority?$object->priority:'')).'" size="5">';
|
print '<input type="text" name="priority" value="'.(GETPOST('priority')?GETPOST('priority'):($object->priority?$object->priority:'')).'" size="5">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('note',(GETPOST('note','none')?GETPOST('note','none'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%');
|
$doleditor=new DolEditor('note',(GETPOST('note','none')?GETPOST('note','none'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_4,'90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -876,10 +954,12 @@ if ($id > 0)
|
|||||||
$object->fulldayevent= GETPOST("fullday")?1:0;
|
$object->fulldayevent= GETPOST("fullday")?1:0;
|
||||||
$object->location = GETPOST('location');
|
$object->location = GETPOST('location');
|
||||||
$object->socid = GETPOST("socid");
|
$object->socid = GETPOST("socid");
|
||||||
|
$socpeopleassigned = GETPOST("socpeopleassigned",'array');
|
||||||
|
foreach ($socpeopleassigned as $tmpid) $object->socpeopleassigned[$id] = array('id' => $tmpid);
|
||||||
$object->contactid = GETPOST("contactid",'int');
|
$object->contactid = GETPOST("contactid",'int');
|
||||||
$object->fk_project = GETPOST("projectid",'int');
|
$object->fk_project = GETPOST("projectid",'int');
|
||||||
|
|
||||||
$object->note = GETPOST("note");
|
$object->note = GETPOST("note",'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
||||||
@ -966,7 +1046,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="minwidth100" value="'.$object->label.'"></td></tr>';
|
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
|
||||||
|
|
||||||
// Full day event
|
// Full day event
|
||||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
||||||
@ -985,7 +1065,7 @@ if ($id > 0)
|
|||||||
else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$userepeatevent=0; // Dev in progress
|
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress
|
||||||
if ($userepeatevent)
|
if ($userepeatevent)
|
||||||
{
|
{
|
||||||
// Repeat
|
// Repeat
|
||||||
@ -1003,13 +1083,13 @@ if ($id > 0)
|
|||||||
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i',$object->recurrule,$reg)) $selectedrecurrulefreq=$reg[1];
|
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i',$object->recurrule,$reg)) $selectedrecurrulefreq=$reg[1];
|
||||||
if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY=(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebymonthday=$reg[1];
|
if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY=(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebymonthday=$reg[1];
|
||||||
if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebyday=$reg[1];
|
if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebyday=$reg[1];
|
||||||
print $form->selectarray('recurrulefreq', $arrayrecurrulefreq, $selectedrecurrulefreq);
|
print $form->selectarray('recurrulefreq', $arrayrecurrulefreq, $selectedrecurrulefreq, 0, 0, 0, '', 0, 0, 0, '', 'marginrightonly');
|
||||||
// If recurrulefreq is MONTHLY
|
// If recurrulefreq is MONTHLY
|
||||||
print '<div class="repeateventBYMONTHDAY">';
|
print '<div class="hidden marginrightonly inline-block repeateventBYMONTHDAY">';
|
||||||
print $langs->trans("DayOfMonth").': <input type="input" size="2" name="BYMONTHDAY" value="'.$selectedrecurrulebymonthday.'">';
|
print $langs->trans("DayOfMonth").': <input type="input" size="2" name="BYMONTHDAY" value="'.$selectedrecurrulebymonthday.'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
// If recurrulefreq is WEEKLY
|
// If recurrulefreq is WEEKLY
|
||||||
print '<div class="repeateventBYDAY">';
|
print '<div class="hidden marginrightonly inline-block repeateventBYDAY">';
|
||||||
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
|
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
@ -1018,13 +1098,13 @@ if ($id > 0)
|
|||||||
{
|
{
|
||||||
if (jQuery("#recurrulefreq").val() == \'MONTHLY\')
|
if (jQuery("#recurrulefreq").val() == \'MONTHLY\')
|
||||||
{
|
{
|
||||||
jQuery(".repeateventBYMONTHDAY").show();
|
jQuery(".repeateventBYMONTHDAY").css("display", "inline-block"); /* use this instead of show because we want inline-block and not block */
|
||||||
jQuery(".repeateventBYDAY").hide();
|
jQuery(".repeateventBYDAY").hide();
|
||||||
}
|
}
|
||||||
else if (jQuery("#recurrulefreq").val() == \'WEEKLY\')
|
else if (jQuery("#recurrulefreq").val() == \'WEEKLY\')
|
||||||
{
|
{
|
||||||
jQuery(".repeateventBYMONTHDAY").hide();
|
jQuery(".repeateventBYMONTHDAY").hide();
|
||||||
jQuery(".repeateventBYDAY").show();
|
jQuery(".repeateventBYDAY").css("display", "inline-block"); /* use this instead of show because we want inline-block and not block */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1050,43 +1130,58 @@ if ($id > 0)
|
|||||||
// Location
|
// Location
|
||||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth100" value="'.$object->location.'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="soixantepercent" value="'.$object->location.'"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assigned to
|
// Assigned to
|
||||||
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
|
$listofuserid=array(); // User assigned
|
||||||
$listofuserid=array();
|
if (empty($donotclearsession))
|
||||||
if (empty($donotclearsession))
|
{
|
||||||
{
|
if ($object->userownerid > 0)
|
||||||
if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->userassigned[$user->id]['transparency'],'answer_status'=>$object->userassigned[$user->id]['answer_status'],'mandatory'=>$object->userassigned[$user->id]['mandatory']); // Owner first
|
{
|
||||||
if (! empty($object->userassigned)) // Now concat assigned users
|
$listofuserid[$object->userownerid]=array(
|
||||||
{
|
'id'=>$object->userownerid,
|
||||||
// Restore array with key with same value than param 'id'
|
'type'=>'user',
|
||||||
$tmplist1=$object->userassigned; $tmplist2=array();
|
//'transparency'=>$object->userassigned[$user->id]['transparency'],
|
||||||
foreach($tmplist1 as $key => $val)
|
'transparency'=>$object->transparency, // Force transparency on ownerfrom event
|
||||||
{
|
'answer_status'=>$object->userassigned[$object->userownerid]['answer_status'],
|
||||||
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
|
'mandatory'=>$object->userassigned[$object->userownerid]['mandatory']
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
$_SESSION['assignedtouser']=json_encode($listofuserid);
|
if (! empty($object->userassigned)) // Now concat assigned users
|
||||||
}
|
{
|
||||||
else
|
// Restore array with key with same value than param 'id'
|
||||||
{
|
$tmplist1=$object->userassigned;
|
||||||
if (!empty($_SESSION['assignedtouser']))
|
foreach($tmplist1 as $key => $val)
|
||||||
{
|
{
|
||||||
$listofuserid=json_decode($_SESSION['assignedtouser'], true);
|
if ($val['id'] && $val['id'] != $object->userownerid)
|
||||||
}
|
{
|
||||||
}
|
$listofuserid[$val['id']]=$val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$_SESSION['assignedtouser']=json_encode($listofuserid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!empty($_SESSION['assignedtouser']))
|
||||||
|
{
|
||||||
|
$listofuserid=json_decode($_SESSION['assignedtouser'], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listofcontactid=$object->socpeopleassigned; // Contact assigned (not used yet)
|
||||||
|
$listofotherid=$object->otherassigned; // Other undefined email (not used yet)
|
||||||
|
|
||||||
|
print '<tr><td class="tdtop nowrap fieldrequired">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
|
||||||
print '<div class="assignedtouser">';
|
print '<div class="assignedtouser">';
|
||||||
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
|
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
if (in_array($user->id,array_keys($listofuserid)))
|
/*if (in_array($user->id,array_keys($listofuserid)))
|
||||||
{
|
{
|
||||||
print '<div class="myavailability">';
|
print '<div class="myavailability">';
|
||||||
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked':'').'>'.$langs->trans("Busy");
|
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked':'').'>'.$langs->trans("Busy");
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}*/
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Realised by
|
// Realised by
|
||||||
@ -1100,15 +1195,15 @@ if ($id > 0)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
print '<br><br>';
|
print '<br><hr><br>';
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
if ($conf->societe->enabled)
|
if ($conf->societe->enabled)
|
||||||
{
|
{
|
||||||
// Related company
|
// Related company
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<div class="maxwidth200onsmartphone">';
|
print '<div class="maxwidth200onsmartphone">';
|
||||||
$events=array(); // 'method'=parameter action of url, 'url'=url to call that return new list of contacts
|
$events=array(); // 'method'=parameter action of url, 'url'=url to call that return new list of contacts
|
||||||
@ -1122,7 +1217,7 @@ if ($id > 0)
|
|||||||
// related contact
|
// related contact
|
||||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
|
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
|
||||||
print '<div class="maxwidth200onsmartphone">';
|
print '<div class="maxwidth200onsmartphone">';
|
||||||
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
|
print $form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -1198,18 +1293,22 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"');
|
$linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"');
|
||||||
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php">'.$langs->trans("BackToList").'</a>';
|
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Link to other agenda views
|
// Link to other agenda views
|
||||||
$out='';
|
$out='';
|
||||||
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
$out.='</li>';
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
$out.='<li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
|
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
|
||||||
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
$out.='</li>';
|
||||||
|
$out.='<li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||||
$out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
$out.='</li>';
|
||||||
|
$out.='<li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
|
$out.='</li>';
|
||||||
|
$out.='<li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
|
||||||
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
@ -1300,11 +1399,19 @@ if ($id > 0)
|
|||||||
$listofuserid=array();
|
$listofuserid=array();
|
||||||
if (empty($donotclearsession))
|
if (empty($donotclearsession))
|
||||||
{
|
{
|
||||||
if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
|
if ($object->userownerid > 0)
|
||||||
|
{
|
||||||
|
$listofuserid[$object->userownerid]=array(
|
||||||
|
'id'=>$object->userownerid,
|
||||||
|
'transparency'=>$object->transparency, // Force transparency on onwer from preoperty of event
|
||||||
|
'answer_status'=>$object->userassigned[$object->userownerid]['answer_status'],
|
||||||
|
'mandatory'=>$object->userassigned[$object->userownerid]['mandatory']
|
||||||
|
);
|
||||||
|
}
|
||||||
if (! empty($object->userassigned)) // Now concat assigned users
|
if (! empty($object->userassigned)) // Now concat assigned users
|
||||||
{
|
{
|
||||||
// Restore array with key with same value than param 'id'
|
// Restore array with key with same value than param 'id'
|
||||||
$tmplist1=$object->userassigned; $tmplist2=array();
|
$tmplist1=$object->userassigned;
|
||||||
foreach($tmplist1 as $key => $val)
|
foreach($tmplist1 as $key => $val)
|
||||||
{
|
{
|
||||||
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
|
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
|
||||||
@ -1319,15 +1426,22 @@ if ($id > 0)
|
|||||||
$listofuserid=json_decode($_SESSION['assignedtouser'], true);
|
$listofuserid=json_decode($_SESSION['assignedtouser'], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$listofcontactid=array(); // not used yet
|
||||||
|
$listofotherid=array(); // not used yet
|
||||||
print '<div class="assignedtouser">';
|
print '<div class="assignedtouser">';
|
||||||
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', ($object->datep != $object->datef)?1:0, $listofuserid, $listofcontactid, $listofotherid);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
/*
|
||||||
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))
|
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))
|
||||||
{
|
{
|
||||||
|
//var_dump($object->userassigned);
|
||||||
|
//var_dump($listofuserid);
|
||||||
print '<div class="myavailability">';
|
print '<div class="myavailability">';
|
||||||
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
|
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
print ' </td></tr>';
|
print ' </td></tr>';
|
||||||
|
|
||||||
// Done by
|
// Done by
|
||||||
@ -1366,20 +1480,30 @@ if ($id > 0)
|
|||||||
// Related contact
|
// Related contact
|
||||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td>';
|
print '<tr><td>'.$langs->trans("ActionOnContact").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($object->contactid > 0)
|
|
||||||
|
if (!empty($object->socpeopleassigned))
|
||||||
{
|
{
|
||||||
print $object->contact->getNomUrl(1);
|
foreach ($object->socpeopleassigned as $cid => $Tab)
|
||||||
if ($object->contactid && $object->type_code == 'AC_TEL')
|
|
||||||
{
|
{
|
||||||
if ($object->contact->fetch($object->contactid))
|
$contact = new Contact($db);
|
||||||
|
$result = $contact->fetch($cid);
|
||||||
|
|
||||||
|
if ($result < 0) dol_print_error($db,$contact->error);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print "<br>".dol_print_phone($object->contact->phone_pro);
|
print $contact->getNomUrl(1);
|
||||||
|
if ($object->type_code == 'AC_TEL')
|
||||||
|
{
|
||||||
|
if (!empty($contact->phone_pro)) print '('.dol_print_phone($contact->phone_pro).')';
|
||||||
|
}
|
||||||
|
print '<div class="paddingright"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<span class="opacitymedium">'.$langs->trans("NoneOrSeveral").'</span>';
|
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,7 +113,12 @@ class ActionComm extends CommonObject
|
|||||||
var $userownerid; // Id of user owner = fk_user_action into table
|
var $userownerid; // Id of user owner = fk_user_action into table
|
||||||
var $userdoneid; // Id of user done (deprecated)
|
var $userdoneid; // Id of user done (deprecated)
|
||||||
|
|
||||||
/**
|
var $socpeopleassigned = array(); // Array of contact ids
|
||||||
|
|
||||||
|
var $otherassigned = array(); // Array of other contact emails (not user, not contact)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
* Object user of owner
|
* Object user of owner
|
||||||
* @var User
|
* @var User
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -225,11 +230,11 @@ class ActionComm extends CommonObject
|
|||||||
if ($this->elementtype=='commande') $this->elementtype='order';
|
if ($this->elementtype=='commande') $this->elementtype='order';
|
||||||
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
||||||
|
|
||||||
if (! is_array($this->userassigned) && ! empty($this->userassigned)) // For backward compatibility
|
if (! is_array($this->userassigned) && ! empty($this->userassigned)) // For backward compatibility when userassigned was an int instead fo array
|
||||||
{
|
{
|
||||||
$tmpid=$this->userassigned;
|
$tmpid=$this->userassigned;
|
||||||
$this->userassigned=array();
|
$this->userassigned=array();
|
||||||
$this->userassigned[$tmpid]=array('id'=>$tmpid);
|
$this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
|
if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
|
||||||
@ -240,7 +245,7 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
|
// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
|
||||||
if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned))
|
if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned))
|
||||||
$this->userassigned = array($userownerid=>array('id'=>$userownerid));
|
$this->userassigned = array($userownerid=>array('id'=>$userownerid, 'transparency'=>$this->transparency));
|
||||||
|
|
||||||
if (! $this->type_id || ! $this->type_code)
|
if (! $this->type_id || ! $this->type_code)
|
||||||
{
|
{
|
||||||
@ -345,6 +350,26 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
if (!empty($this->socpeopleassigned))
|
||||||
|
{
|
||||||
|
foreach ($this->socpeopleassigned as $id => $Tab)
|
||||||
|
{
|
||||||
|
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
|
$sql.=" VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->errors[]=$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$action='create';
|
$action='create';
|
||||||
@ -432,7 +457,8 @@ class ActionComm extends CommonObject
|
|||||||
$objFrom = clone $this;
|
$objFrom = clone $this;
|
||||||
|
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
$this->fetch_userassigned();
|
// $this->fetch_userassigned();
|
||||||
|
$this->fetchResources();
|
||||||
|
|
||||||
$this->id=0;
|
$this->id=0;
|
||||||
|
|
||||||
@ -545,8 +571,9 @@ class ActionComm extends CommonObject
|
|||||||
$this->type_color = $obj->type_color;
|
$this->type_color = $obj->type_color;
|
||||||
$this->type_picto = $obj->type_picto;
|
$this->type_picto = $obj->type_picto;
|
||||||
$transcode=$langs->trans("Action".$obj->type_code);
|
$transcode=$langs->trans("Action".$obj->type_code);
|
||||||
$type_label=($transcode!="Action".$obj->type_code?$transcode:$obj->type_label);
|
$this->type = (($transcode!="Action".$obj->type_code) ? $transcode : $obj->type_label);
|
||||||
$this->type = $type_label;
|
$transcode=$langs->trans("Action".$obj->type_code.'Short');
|
||||||
|
$this->type_short = (($transcode!="Action".$obj->type_code.'Short') ? $transcode : '');
|
||||||
|
|
||||||
$this->code = $obj->code;
|
$this->code = $obj->code;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
@ -563,11 +590,11 @@ class ActionComm extends CommonObject
|
|||||||
$this->authorid = $obj->fk_user_author;
|
$this->authorid = $obj->fk_user_author;
|
||||||
$this->usermodid = $obj->fk_user_mod;
|
$this->usermodid = $obj->fk_user_mod;
|
||||||
|
|
||||||
if (!is_object($this->author)) $this->author = new stdClass(); // For avoid warning
|
if (!is_object($this->author)) $this->author = new stdClass(); // To avoid warning
|
||||||
$this->author->id = $obj->fk_user_author; // deprecated
|
$this->author->id = $obj->fk_user_author; // deprecated
|
||||||
$this->author->firstname = $obj->firstname; // deprecated
|
$this->author->firstname = $obj->firstname; // deprecated
|
||||||
$this->author->lastname = $obj->lastname; // deprecated
|
$this->author->lastname = $obj->lastname; // deprecated
|
||||||
if (!is_object($this->usermod)) $this->usermod = new stdClass(); // For avoid warning
|
if (!is_object($this->usermod)) $this->usermod = new stdClass(); // To avoid warning
|
||||||
$this->usermod->id = $obj->fk_user_mod; // deprecated
|
$this->usermod->id = $obj->fk_user_mod; // deprecated
|
||||||
|
|
||||||
$this->userownerid = $obj->fk_user_action;
|
$this->userownerid = $obj->fk_user_action;
|
||||||
@ -587,6 +614,8 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
$this->fk_element = $obj->fk_element;
|
$this->fk_element = $obj->fk_element;
|
||||||
$this->elementtype = $obj->elementtype;
|
$this->elementtype = $obj->elementtype;
|
||||||
|
|
||||||
|
$this->fetchResources();
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
}
|
}
|
||||||
@ -600,6 +629,50 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize $this->userassigned & this->socpeopleassigned array with list of id of user and contact assigned to event
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetchResources()
|
||||||
|
{
|
||||||
|
$sql ='SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency';
|
||||||
|
$sql.=' FROM '.MAIN_DB_PREFIX.'actioncomm_resources';
|
||||||
|
$sql.=' WHERE fk_actioncomm = '.$this->id;
|
||||||
|
$sql.=" AND element_type IN ('user', 'socpeople')";
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->userassigned=array();
|
||||||
|
$this->socpeopleassigned=array();
|
||||||
|
|
||||||
|
// If owner is known, we must but id first into list
|
||||||
|
if ($this->userownerid > 0) $this->userassigned[$this->userownerid]=array('id'=>$this->userownerid); // Set first so will be first into list.
|
||||||
|
|
||||||
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
if ($obj->fk_element > 0)
|
||||||
|
{
|
||||||
|
switch ($obj->element_type) {
|
||||||
|
case 'user':
|
||||||
|
$this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
|
||||||
|
if (empty($this->userownerid)) $this->userownerid=$obj->fk_element; // If not defined (should not happened, we fix this)
|
||||||
|
break;
|
||||||
|
case 'socpeople':
|
||||||
|
$this->socpeopleassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this->userassigned array with list of id of user assigned to event
|
* Initialize this->userassigned array with list of id of user assigned to event
|
||||||
@ -822,6 +895,29 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
|
{
|
||||||
|
$sql ="DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources where fk_actioncomm = ".$this->id." AND element_type = 'socpeople'";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (!empty($this->socpeopleassigned))
|
||||||
|
{
|
||||||
|
foreach (array_keys($this->socpeopleassigned) as $id)
|
||||||
|
{
|
||||||
|
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||||
|
$sql.=" VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->errors[]=$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
@ -943,7 +1039,7 @@ class ActionComm extends CommonObject
|
|||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||||
$response->label = $langs->trans("ActionsToDo");
|
$response->label = $langs->trans("ActionsToDo");
|
||||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
$response->url = DOL_URL_ROOT.'/comm/action/list.php?status=todo&mainmenu=agenda';
|
||||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||||
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
|
||||||
}
|
}
|
||||||
@ -1119,7 +1215,7 @@ class ActionComm extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0, $notooltip=0)
|
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0, $notooltip=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user, $hookmanager;
|
global $conf, $langs, $user, $hookmanager, $action;
|
||||||
|
|
||||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||||
|
|
||||||
@ -1135,7 +1231,7 @@ class ActionComm extends CommonObject
|
|||||||
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
|
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
$tooltip = '<u>' . $langs->trans('ShowAction') . '</u>';
|
||||||
if (! empty($this->ref))
|
if (! empty($this->ref))
|
||||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
if (! empty($label))
|
if (! empty($label))
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class AgendaEvents extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Event $actioncomm {@type ActionComm}
|
* @var ActionComm $actioncomm {@type ActionComm}
|
||||||
*/
|
*/
|
||||||
public $actioncomm;
|
public $actioncomm;
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class AgendaEvents extends DolibarrApi
|
|||||||
throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! DolibarrApi::_checkAccessToResource('agenda',$this->actioncomm->id)) {
|
if ( ! DolibarrApi::_checkAccessToResource('agenda',$this->actioncomm->id,'actioncomm','','fk_soc','id')) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,11 +115,11 @@ class AgendaEvents extends DolibarrApi
|
|||||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
|
|
||||||
$sql = "SELECT t.id as rowid";
|
$sql = "SELECT t.id as rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
$sql.= ' WHERE t.entity IN ('.getEntity('agenda').')';
|
$sql.= ' WHERE t.entity IN ('.getEntity('agenda').')';
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||||
if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")";
|
if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")";
|
||||||
if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid;
|
if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid;
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
@ -153,6 +153,7 @@ class AgendaEvents extends DolibarrApi
|
|||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
$i=0;
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
while ($i < $min)
|
while ($i < $min)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user