Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
fappels 2015-11-16 16:44:24 +01:00
commit e4b821c266
500 changed files with 22503 additions and 18433 deletions

View File

@ -131,8 +131,9 @@ script:
# - cat upgrade370380.log # - cat upgrade370380.log
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
- php upgrade.php 3.8.0 3.9.0 ignoredbversion > upgrade380390.log - php upgrade.php 3.8.0 3.9.0 ignoredbversion > upgrade380390.log
# - cat upgrade380390.log
- php upgrade2.php 3.8.0 3.9.0 ignoredbversion > upgrade380390-2.log - php upgrade2.php 3.8.0 3.9.0 ignoredbversion > upgrade380390-2.log
# - cat upgrade370380-2.log # - cat upgrade380390-2.log
- cd ../.. - cd ../..
- date - date
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php

View File

@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.hrm]
file_filter = htdocs/langs/<lang>/hrm.lang
source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.incoterm] [dolibarr.incoterm]
file_filter = htdocs/langs/<lang>/incoterm.lang file_filter = htdocs/langs/<lang>/incoterm.lang
source_file = htdocs/langs/en_US/incoterm.lang source_file = htdocs/langs/en_US/incoterm.lang
@ -218,6 +224,12 @@ source_file = htdocs/langs/en_US/members.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.oauth]
file_filter = htdocs/langs/<lang>/oauth.lang
source_file = htdocs/langs/en_US/oauth.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.opensurvey] [dolibarr.opensurvey]
file_filter = htdocs/langs/<lang>/opensurvey.lang file_filter = htdocs/langs/<lang>/opensurvey.lang
source_file = htdocs/langs/en_US/opensurvey.lang source_file = htdocs/langs/en_US/opensurvey.lang
@ -278,6 +290,12 @@ source_file = htdocs/langs/en_US/propal.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.receiptprinter]
file_filter = htdocs/langs/<lang>/receiptprinter.lang
source_file = htdocs/langs/en_US/receiptprinter.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.resource] [dolibarr.resource]
file_filter = htdocs/langs/<lang>/resource.lang file_filter = htdocs/langs/<lang>/resource.lang
source_file = htdocs/langs/en_US/resource.lang source_file = htdocs/langs/en_US/resource.lang

View File

@ -16,6 +16,7 @@ AdoDb-Date 0.33 Modified BSD License Yes
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
FirePHPCore 0.4.0 MIT License Yes Send logs to Firefox Firebug console FirePHPCore 0.4.0 MIT License Yes Send logs to Firefox Firebug console
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
@ -25,6 +26,7 @@ PEAR Mail_MIME 1.8.9 BSD Yes
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Raven-php 0.12.1 MIT License Yes Used for server-side error logging with Sentry logger Raven-php 0.12.1 MIT License Yes Used for server-side error logging with Sentry logger
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
@ -56,7 +58,7 @@ JsTimezoneDetect 1.0.4 MIT License Yes
Raven.js 1.1.19 MIT License Yes Used for client-side error logging with Sentry logger Raven.js 1.1.19 MIT License Yes Used for client-side error logging with Sentry logger
For licenses compatibility informations: For licenses compatibility informations:
http://www.fsf.org/licensing/licenses/index_html http://www.gnu.org/licenses/licenses.en.html
Copyright Copyright

View File

@ -2,7 +2,9 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40. WARNING:
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost. Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration. You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying Upgrading to any other version or any other database system is abolutely required BEFORE trying
@ -11,10 +13,20 @@ make a Dolibarr upgrade.
***** ChangeLog for 3.9 compared to 3.8.* ***** ***** ChangeLog for 3.9 compared to 3.8.* *****
WARNING: Following changes may create regression for some external modules, but were necessary to make WARNING:
Following changes may create regression for some external modules, but were necessary to make
Dolibarr better: Dolibarr better:
- Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use table llx_overwrite_trans instead. - Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use table llx_overwrite_trans instead.
- Trigger LINECONTRACT_INSERT has been renamed into LINECONTRACT_CREATE to match common denomination. - Trigger LINECONTRACT_INSERT has been renamed into LINECONTRACT_CREATE to match common denomination.
- A lot hooks used into PDF generation were not correctly implemented. We had to fix this. The result si that
the following hook were set as hook of type "replace". This means if your module implement such hooks, it must
return 0 to execute standard code or 1 to replace standard code (value to output should be set into resPrints instead).
This is list of hooks modified:
'pdf_getlinenum', 'pdf_getlineref', 'pdf_getlineref_supplier', 'pdf_getlinevatrate', 'pdf_getlineupexcltax',
'pdf_getlineupwithtax', 'pdf_getlineqty', 'pdf_getlineqty_asked', 'pdf_getlineqty_shipped', 'pdf_getlineqty_keeptoship',
'pdf_getlineunit', 'pdf_getlineremisepercent', 'pdf_getlineprogress', 'pdf_getlinetotalexcltax', 'pdf_getlinetotalwithtax'
***** ChangeLog for 3.8.1 compared to 3.8.0 ***** ***** ChangeLog for 3.8.1 compared to 3.8.0 *****
@ -348,9 +360,11 @@ FIX send mail, copy sendto don't read the list of contact
FIX Properly escape untrusted data to prevent HTML injection. FIX Properly escape untrusted data to prevent HTML injection.
FIX send mail, copy sendto don't read the list of contact FIX send mail, copy sendto don't read the list of contact
Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose WARNING:
your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to
restore old path. Path to save photos of products was moved to match path of other attached files. If you had loose your photo
on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to 1 (home - setup - other)
to restore old path and get back working links without having to resubmit images.
WARNING: WARNING:
@ -523,11 +537,14 @@ You may also experience troubles with Mysql 5.5.41 with error "Lost connection"
Upgrading to any other version or database system is abolutely required BEFORE trying to Upgrading to any other version or database system is abolutely required BEFORE trying to
make a Dolibarr upgrade. make a Dolibarr upgrade.
WARNING: Following changes may create regression for some external modules, but was necessary to make WARNING:
Following changes may create regression for some external modules, but was necessary to make
Dolibarr better: Dolibarr better:
- Path to save photos of products was moved to match path of other attached files. If you had loose your photo - Path to save photos of products was moved to match path of other attached files. If you had loose your photo
on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to restore old path. on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to 1 (home - setup - other)
to restore old path and get back working links without having to resubmit images.
- If you can't see trips and expenses records, check that you have the new permission "read all - If you can't see trips and expenses records, check that you have the new permission "read all
trips and expenses". trips and expenses".
- Deprecated module "oscommerce" were removed. - Deprecated module "oscommerce" were removed.

View File

@ -1,5 +1,7 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dd/dolibarr.svg)
Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...). Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances. It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances.

View File

@ -17,6 +17,7 @@
"ext-curl": "*", "ext-curl": "*",
"ccampbell/chromephp": "^4.1", "ccampbell/chromephp": "^4.1",
"ckeditor/ckeditor": "4.3.3", "ckeditor/ckeditor": "4.3.3",
"mike42/escpos-php": "dev-master",
"mobiledetect/mobiledetectlib": "2.8.3", "mobiledetect/mobiledetectlib": "2.8.3",
"phpoffice/phpexcel": "1.8.0", "phpoffice/phpexcel": "1.8.0",
"restler/framework": "^3.0", "restler/framework": "^3.0",

66
composer.lock generated
View File

@ -4,7 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "f441e6348ae7862942693cab10810418", "hash": "d88b5c84a9ea1af354d867ba2e2ab251",
"content-hash": "85e60ec7f8ab593387c7bd10d8db860d",
"packages": [ "packages": [
{ {
"name": "ccampbell/chromephp", "name": "ccampbell/chromephp",
@ -126,6 +127,64 @@
"homepage": "https://github.com/firephp/firephp-core", "homepage": "https://github.com/firephp/firephp-core",
"time": "2013-04-23 15:28:20" "time": "2013-04-23 15:28:20"
}, },
{
"name": "mike42/escpos-php",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/mike42/escpos-php.git",
"reference": "0564ff94de45564221eca99c4cd5ab24492894c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/0564ff94de45564221eca99c4cd5ab24492894c2",
"reference": "0564ff94de45564221eca99c4cd5ab24492894c2",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.5.*"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roni Saha",
"email": "roni.cse@gmail.com"
},
{
"name": "Michael Billington",
"email": "michael.billington@gmail.com"
},
{
"name": "Gergely Radics",
"email": "gerifield@ustream.tv"
},
{
"name": "Warren Doyle",
"email": "w.doyle@fuelled.co"
},
{
"name": "vharo",
"email": "vharo@geepok.com"
}
],
"description": "Thermal receipt printer library, for use with ESC/POS compatible printers",
"homepage": "https://github.com/mike42/escpos-php",
"keywords": [
"ESC-POS",
"driver",
"escpos",
"print",
"receipt"
],
"time": "2015-11-02 10:50:46"
},
{ {
"name": "mobiledetect/mobiledetectlib", "name": "mobiledetect/mobiledetectlib",
"version": "2.8.3", "version": "2.8.3",
@ -424,13 +483,16 @@
"pdf417", "pdf417",
"qrcode" "qrcode"
], ],
"abandoned": "tecnickcom/tcpdf",
"time": "2015-01-28 18:51:40" "time": "2015-01-28 18:51:40"
} }
], ],
"packages-dev": [], "packages-dev": [],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {
"mike42/escpos-php": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {

File diff suppressed because one or more lines are too long

View File

@ -450,186 +450,214 @@ else $error++;
//-------------------------------- //--------------------------------------------------------------------
// Build skeleton_script.php // Build skeleton_script.php, skeleton_list.php and skeleton_card.php
//-------------------------------- //--------------------------------------------------------------------
// Read skeleton_script.php file $skeletonfiles=array(
$skeletonfile=$path.'skeleton_script.php'; $path.'skeleton_script.php' => 'out.'.$classmin.'_script.php',
$sourcecontent=file_get_contents($skeletonfile); $path.'skeleton_list.php' => 'out.'.$classmin.'_list.php',
if (! $sourcecontent) $path.'skeleton_card.php' => 'out.'.$classmin.'_card.php'
);
foreach ($skeletonfiles as $skeletonfile => $outfile)
{ {
print "\n"; $sourcecontent=file_get_contents($skeletonfile);
print "Error: Failed to read skeleton sample '".$skeletonfile."'\n"; if (! $sourcecontent)
print "Try to run script from skeletons directory.\n"; {
exit; print "\n";
print "Error: Failed to read skeleton sample '".$skeletonfile."'\n";
print "Try to run script from skeletons directory.\n";
exit;
}
// Define output variables
$targetcontent=$sourcecontent;
// Substitute module name
$targetcontent=preg_replace('/dev\/skeletons/', $module, $targetcontent);
$targetcontent=preg_replace('/mymodule othermodule1 othermodule2/', $module, $targetcontent);
$targetcontent=preg_replace('/mymodule/', $module, $targetcontent);
// Substitute class name
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
$targetcontent=preg_replace('/\$element = \'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element = \'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
$targetcontent=preg_replace('/skeletons/', $classmin, $targetcontent);
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
// Substitute comments
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
$targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent);
$targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent);
// Substitute table name
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
// Substitute GETPOST search_fieldx
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
if ($prop['isint']) $varprop.='$search_'.$prop['field']."=GETPOST('search_".$prop['field']."','int');\n";
else $varprop.='$search_'.$prop['field']."=GETPOST('search_".$prop['field']."','alpha');\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('$search_field1=GETPOST("search_field1");','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('$search_field2=GETPOST("search_field2");','/').'/', '', $targetcontent);
// Substitute GETPOST fieldx
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
if ($prop['isint']) $varprop.="\t\$object->".$prop['field']."=GETPOST('".$prop['field']."','int');\n";
else $varprop.="\t\$object->".$prop['field']."=GETPOST('".$prop['field']."','alpha');\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('$object->prop1=GETPOST("field1");','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('$object->prop2=GETPOST("field2");','/').'/', '', $targetcontent);
// Substitute reset search_field = '';
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.='$search_'.$prop['field']."='';\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('$search_field1=\'\';','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('$search_field2=\'\';','/').'/', '', $targetcontent);
// Substitute fetch/select parameters
$targetcontent=preg_replace('/\$sql\s*\.= " t\.field1,";/', $varpropselect, $targetcontent);
$targetcontent=preg_replace('/\$sql\s*\.= " t\.field2";/', '', $targetcontent);
// Substitute where for search
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.='if ($search_'.$prop['field'].') $sql.= natural_search("'.$prop['field'].'",$search_'.$prop['field'].');'."\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('if ($search_field1) $sql.= natural_search("field1",$search_field1);','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('if ($search_field2) $sql.= natural_search("field2",$search_field2);','/').'/', '', $targetcontent);
// substitute $params.=
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="if (\$search_".$prop['field']." != '') \$params.= '&amp;search_".$prop['field']."='.urlencode(\$search_".$prop['field'].");\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("if (\$search_field1 != '') \$params.= '&amp;search_field1='.urlencode(\$search_field1);",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("if (\$search_field2 != '') \$params.= '&amp;search_field2='.urlencode(\$search_field2);",'/').'/', '', $targetcontent);
// Substitute arrayfields
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="'t.".$prop['field']."'=>array('label'=>\$langs->trans(\"Field".$prop['field']."\"), 'checked'=>1),\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("'t.field1'=>array('label'=>\$langs->trans(\"Field1\"), 'checked'=>1),",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("'t.field2'=>array('label'=>\$langs->trans(\"Field2\"), 'checked'=>1),",'/').'/', '', $targetcontent);
// Substitute print_liste_field_titre
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print_liste_field_titre(\$arrayfields['t.".$prop['field']."']['label'],\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field2','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent);
// Substitute fields title search
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print '<td class=\"liste_titre\"><input type=\"text\" class=\"flat\" name=\"search_".$prop['field']."\" value=\"'.\$search_".$prop['field'].".'\" size=\"10\"></td>';\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '<td class=\"liste_titre\"><input type=\"text\" class=\"flat\" name=\"search_field1\" value=\"'.\$search_field1.'\" size=\"10\"></td>';",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '<td class=\"liste_titre\"><input type=\"text\" class=\"flat\" name=\"search_field2\" value=\"'.\$search_field2.'\" size=\"10\"></td>';",'/').'/', '', $targetcontent);
// Substitute where for <td>.fieldx.</td>
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="if (! empty(\$arrayfields['t.".$prop['field']."']['checked'])) print '<td>'.\$obj->".$prop['field'].".'</td>';\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print '<td>'.\$obj->field1.'</td>';",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print '<td>'.\$obj->field2.'</td>';",'/').'/', '', $targetcontent);
// LIST_OF_TD_LABEL_FIELDS_CREATE and EDIT - List of td for card view
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td><input class=\"flat\" type=\"text\" name=\"".$prop['field']."\" value=\"'.\$".$prop['field'].".'\"></td></tr>';\n";
}
}
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_CREATE/', $varprop, $targetcontent);
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_EDIT/', $varprop, $targetcontent);
// LIST_OF_TD_LABEL_FIELDS_VIEW - List of td for card view
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td>\$object->".$prop['field']."</td></tr>';\n";
}
}
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent);
// Build file
$fp=fopen($outfile,"w");
if ($fp)
{
fputs($fp, $targetcontent);
fclose($fp);
print "File '".$outfile."' has been built in current directory.\n";
}
else $error++;
} }
// Define output variables
$outfile='out.'.$classmin.'_script.php';
$targetcontent=$sourcecontent;
// Substitute module name
$targetcontent=preg_replace('/dev\/skeletons/', $module, $targetcontent);
$targetcontent=preg_replace('/mymodule othermodule1 othermodule2/', $module, $targetcontent);
$targetcontent=preg_replace('/mymodule/', $module, $targetcontent);
// Substitute class name
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
$targetcontent=preg_replace('/\$element = \'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element = \'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
$targetcontent=preg_replace('/skeletons/', $classmin, $targetcontent);
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
// Substitute comments
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
$targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent);
$targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent);
// Substitute table name
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
// Build file
$fp=fopen($outfile,"w");
if ($fp)
{
fputs($fp, $targetcontent);
fclose($fp);
print "File '".$outfile."' has been built in current directory.\n";
}
else $error++;
//--------------------------------
// Build skeleton_page.php
//--------------------------------
// Read skeleton_page.php file
$skeletonfile=$path.'skeleton_page.php';
$sourcecontent=file_get_contents($skeletonfile);
if (! $sourcecontent)
{
print "\n";
print "Error: Failed to read skeleton sample '".$skeletonfile."'\n";
print "Try to run script from skeletons directory.\n";
exit;
}
// Define output variables
$outfile='out.'.$classmin.'_page.php';
$targetcontent=$sourcecontent;
// Substitute module name
$targetcontent=preg_replace('/dev\/skeletons/', $module, $targetcontent);
$targetcontent=preg_replace('/mymodule othermodule1 othermodule2/', $module, $targetcontent);
$targetcontent=preg_replace('/mymodule/', $module, $targetcontent);
// Substitute class name
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
$targetcontent=preg_replace('/\$element = \'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element = \'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
$targetcontent=preg_replace('/skeletons/', $classmin, $targetcontent);
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
// Substitute comments
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
$targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent);
$targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent);
// Substitute table name
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
// Substitute GETPOST search_fieldx
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
if ($prop['isint']) $varprop.='$search_'.$prop['field']."=GETPOST('search_".$prop['field']."','int');\n";
else $varprop.='$search_'.$prop['field']."=GETPOST('search_".$prop['field']."','alpha');\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('$search_field1=GETPOST("search_field1");','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('$search_field2=GETPOST("search_field2");','/').'/', '', $targetcontent);
// Substitute GETPOST fieldx
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
if ($prop['isint']) $varprop.="\t\$object->".$prop['field']."=GETPOST('".$prop['field']."','int');\n";
else $varprop.="\t\$object->".$prop['field']."=GETPOST('".$prop['field']."','alpha');\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('$object->prop1=GETPOST("field1");','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('$object->prop2=GETPOST("field2");','/').'/', '', $targetcontent);
// Substitute fetch/select parameters
$targetcontent=preg_replace('/\$sql\s*\.= " t\.field1,";/', $varpropselect, $targetcontent);
$targetcontent=preg_replace('/\$sql\s*\.= " t\.field2";/', '', $targetcontent);
// Substitute where for search
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.='if ($search_'.$prop['field'].') $sql.= natural_search("'.$prop['field'].'",$search_'.$prop['field'].');'."\n";
}
}
$targetcontent=preg_replace('/'.preg_quote('if ($search_field1) $sql.= natural_search("field1",$search_field1);','/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote('if ($search_field2) $sql.= natural_search("field2",$search_field2);','/').'/', '', $targetcontent);
// Substitute print_liste_field_titre
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print_liste_field_titre(\$langs->trans('".$prop['field']."'),\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent);
// Substitute where for <td>.fieldx.</td>
$varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<td>'.\$obj->".$prop['field'].".'</td>';\n";
}
}
$targetcontent=preg_replace('/'.preg_quote("print '<td>'.\$obj->field1.'</td>';",'/').'/', $varprop, $targetcontent);
$targetcontent=preg_replace('/'.preg_quote("print '<td>'.\$obj->field2.'</td>';",'/').'/', '', $targetcontent);
// Build file
$fp=fopen($outfile,"w");
if ($fp)
{
fputs($fp, $targetcontent);
fclose($fp);
print "File '".$outfile."' has been built in current directory.\n";
}
else $error++;
// -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT -------------------- // -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
print "You can now rename generated files by removing the 'out.' prefix in their name and store them into directory /yourmodule/class.\n"; print "You can now rename generated files by removing the 'out.' prefix in their name and store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n";
return $error; return $error;

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file dev/skeletons/skeleton_page.php * \file dev/skeletons/skeleton_card.php
* \ingroup mymodule othermodule1 othermodule2 * \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example of a php page * \brief This file is an example of a php page
* Put here some comments * Put here some comments
@ -47,7 +47,7 @@ include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
dol_include_once('/mymodule/class/skeleton_class.class.php'); dol_include_once('/mymodule/class/skeleton_class.class.php');
// Load traductions files requiredby by page // Load traductions files requiredby by page
$langs->load("companies"); $langs->load("mymodule");
$langs->load("other"); $langs->load("other");
// Get parameters // Get parameters
@ -184,7 +184,7 @@ if (empty($reshook))
{ {
// Delete OK // Delete OK
setEventMessages("RecordDeleted", null, 'mesgs'); setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1)); header("Location: ".dol_buildpath('/mymodule/list.php',1));
exit; exit;
} }
else else
@ -227,131 +227,10 @@ jQuery(document).ready(function() {
</script>'; </script>';
// Part to show a list
if ($action == 'list' || (empty($id) && $action != 'create'))
{
// Put here content of your page
print load_fiche_titre('PageTitle');
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
$sql.= " WHERE 1 = 1";
if ($search_field1) $sql.= natural_search("field1",$search_field1);
if ($search_field2) $sql.= natural_search("field2",$search_field2);
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog($script_file, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$params='';
$params.= '&amp;search_field1='.urlencode($search_field1);
$params.= '&amp;search_field2='.urlencode($search_field2);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies');
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="liste">'."\n";
// Fields title
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>'."\n";
// Fields title search
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10"></td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>'."\n";
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
// You can use here results
print '<tr>';
print '<td>'.$obj->field1.'</td>';
print '<td>'.$obj->field2.'</td>';
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>';
}
$i++;
}
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
}
else
{
$error++;
dol_print_error($db);
}
}
// Part to create // Part to create
if ($action == 'create') if ($action == 'create')
{ {
print load_fiche_titre($langs->trans("NewSkeleton")); print load_fiche_titre($langs->trans("NewMyModule"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -360,10 +239,8 @@ if ($action == 'create')
dol_fiche_head(); dol_fiche_head();
print '<table class="border centpercent">'."\n"; print '<table class="border centpercent">'."\n";
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>'; // print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
print '<input class="flat" type="text" size="36" name="label" value="'.$label.'">'; // LIST_OF_TD_LABEL_FIELDS_CREATE
print '</td></tr>';
print '</table>'."\n"; print '</table>'."\n";
dol_fiche_end(); dol_fiche_end();
@ -378,17 +255,25 @@ if ($action == 'create')
// Part to edit record // Part to edit record
if (($id || $ref) && $action == 'edit') if (($id || $ref) && $action == 'edit')
{ {
print load_fiche_titre($langs->trans("MyModule"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head();
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
dol_fiche_head();
print '<table class="border centpercent">'."\n";
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
// LIST_OF_TD_LABEL_FIELDS_EDIT
print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"></div>'; print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>'; print '</form>';
} }
@ -398,10 +283,15 @@ if (($id || $ref) && $action == 'edit')
// Part to show record // Part to show record
if ($id && (empty($action) || $action == 'view')) if ($id && (empty($action) || $action == 'view'))
{ {
print load_fiche_titre($langs->trans("MyModule"));
dol_fiche_head(); dol_fiche_head();
print '<table class="border centpercent">'."\n";
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
// LIST_OF_TD_LABEL_FIELDS_VIEW
print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@ -426,6 +426,101 @@ class Skeleton_Class extends CommonObject
} }
} }
/**
* Return a link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to
* @param integer $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @param string $morecss Add more css on link
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
$result = '';
$companylink = '';
$label = '<u>' . $langs->trans("MyModule") . '</u>';
$label.= '<div width="100%">';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/mymodule/card.php?id='.$this->id.'"';
$link.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
$link.= '>';
$linkend='</a>';
if ($withpicto)
{
$result.=($link.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto != 2) $result.=' ';
}
$result.= $link . $this->ref . $linkend;
return $result;
}
/**
* Retourne le libelle du status d'un user (actif, inactif)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->status,$mode);
}
/**
* Renvoi le libelle d'un status donne
*
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function LibStatut($status,$mode=0)
{
global $langs;
if ($mode == 0)
{
$prefix='';
if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled');
}
if ($mode == 1)
{
if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled');
}
if ($mode == 2)
{
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
}
if ($mode == 3)
{
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
}
if ($mode == 4)
{
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
}
if ($mode == 5)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
}
}
/** /**
* Initialise object with example values * Initialise object with example values
* Id must be 0 if object instance is a specimen * Id must be 0 if object instance is a specimen

View File

@ -0,0 +1,439 @@
<?php
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 dev/skeletons/skeleton_list.php
* \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example of a php page
* Put here some comments
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
// Change this following line to use the correct relative path (../, ../../, etc)
$res=0;
if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
if (! $res) die("Include of main fails");
// Change this following line to use the correct relative path from htdocs
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
dol_include_once('/mymodule/class/skeleton_class.class.php');
// Load traductions files requiredby by page
$langs->load("mymodule");
$langs->load("other");
// Get parameters
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$backtopage = GETPOST('backtopage');
$myparam = GETPOST('myparam','alpha');
$search_field1=GETPOST("search_field1");
$search_field2=GETPOST("search_field2");
$optioncss = GETPOST('optioncss','alpha');
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="t.rowid"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
// Protection if external user
$socid=0;
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
//accessforbidden();
}
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('skeletonlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('mymodule');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Load object if id or ref is provided as parameter
$object=new Skeleton_Class($db);
if (($id > 0 || ! empty($ref)) && $action != 'add')
{
$result=$object->fetch($id,$ref);
if ($result < 0) dol_print_error($db);
}
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$search_field1='';
$search_field2='';
$search_date_creation='';
$search_date_update='';
$search_array_options=array();
}
if (empty($reshook))
{
// Action to delete
if ($action == 'confirm_delete')
{
$result=$object->delete($user);
if ($result > 0)
{
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".dol_buildpath('/mymodule/list.php',1));
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
else setEventMessages($object->error,null,'errors');
}
}
}
/***************************************************
* VIEW
*
* Put here all code to build page
****************************************************/
llxHeader('','MyPageName','');
$form=new Form($db);
// Put here content of your page
$title = $langs->trans('MyModuleListTitle');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (u.rowid = ef.fk_object)";
$sql.= " WHERE 1 = 1";
//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")";
if ($search_field1) $sql.= natural_search("field1",$search_field1);
if ($search_field2) $sql.= natural_search("field2",$search_field2);
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.=$db->order($sortfield,$sortorder);
//$sql.= $db->plimit($conf->liste_limit+1, $offset);
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog($script_file, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$params='';
if ($search_field1 != '') $params.= '&amp;search_field1='.urlencode($search_field1);
if ($search_field2 != '') $params.= '&amp;search_field2='.urlencode($search_field2);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies');
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$arrayfields=array(
't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1),
't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
// Fields title
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
// 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']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>'."\n";
// Fields title search
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.field1']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10"></td>';
if (! empty($arrayfields['t.field2']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10"></td>';
// 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 class="liste_titre"></td>';
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['t.datec']['checked']))
{
// Date creation
print '<td class="liste_titre">';
print '</td>';
}
if (! empty($arrayfields['t.tms']['checked']))
{
// Date modification
print '<td class="liste_titre">';
print '</td>';
}
/*if (! empty($arrayfields['u.statut']['checked']))
{
// Status
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
print '</td>';
}*/
// Action column
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>'."\n";
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
// You can use here results
print '<tr>';
if (! empty($arrayfields['t.field1']['checked'])) print '<td>'.$obj->field1.'</td>';
if (! empty($arrayfields['t.field2']['checked'])) print '<td>'.$obj->field2.'</td>';
// 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>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['t.datec']['checked']))
{
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
print '</td>';
}
// Date modification
if (! empty($arrayfields['t.tms']['checked']))
{
print '<td align="center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
print '</td>';
}
// Status
/*
if (! empty($arrayfields['u.statut']['checked']))
{
$userstatic->statut=$obj->statut;
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
}*/
// Action column
print '<td></td>';
print '</tr>';
}
$i++;
}
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
$db->free($result);
}
else
{
$error++;
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -76,7 +76,7 @@ if ($action == 'disable') {
$action = 'update'; $action = 'update';
if ($result < 0) { if ($result < 0) {
setEventMessage($accounting->error, 'errors'); setEventMessages($accounting->error, $accounting->errors, 'errors');
} }
} else if ($action == 'enable') { } else if ($action == 'enable') {
if ($accounting->fetch($id)) { if ($accounting->fetch($id)) {
@ -84,7 +84,7 @@ if ($action == 'disable') {
} }
$action = 'update'; $action = 'update';
if ($result < 0) { if ($result < 0) {
setEventMessage($accounting->error, 'errors'); setEventMessages($accounting->error, $accounting->errors, 'errors');
} }
} }

View File

@ -125,7 +125,7 @@ else if ($action == 'delete')
} }
if ($result < 0) { if ($result < 0) {
setEventMessage($accounting->error, 'errors'); setEventMessages($accounting->error, $accounting->errors, 'errors');
} }
} }

View File

@ -100,9 +100,9 @@ if ($action == 'update') {
} }
if (! $error) { if (! $error) {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -84,12 +84,12 @@ else if ($action == 'add')
if (empty($object->date_start) && empty($object->date_end)) if (empty($object->date_start) && empty($object->date_end))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++; $error++;
} }
if (empty($object->label)) if (empty($object->label))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$error++; $error++;
} }
@ -110,7 +110,7 @@ else if ($action == 'add')
{ {
$db->rollback(); $db->rollback();
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action='create'; $action='create';
} }
} }
@ -147,7 +147,7 @@ else if ($action == 'update')
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
else else

View File

@ -76,14 +76,14 @@ if ($_POST["action"] == 'import') {
$result = $accounting->create($user); $result = $accounting->create($user);
if ($result > 0) { if ($result > 0) {
setEventMessage($langs->trans("AccountingAccountAdd"), 'mesgs'); setEventMessages($langs->trans("AccountingAccountAdd"), null, 'mesgs');
} else { } else {
setEventMessage($accounting->error, 'errors'); setEventMessages($accounting->error, $accounting->errors, 'errors');
} }
$cpt ++; $cpt ++;
} }
} else { } else {
setEventMessage($langs->trans('AccountPlanNotFoundCheckSetting'), 'errors'); setEventMessages($langs->trans('AccountPlanNotFoundCheckSetting'), null, 'errors');
} }
} else { } else {
print '<div><font color="red">' . $langs->trans("AnyLineImport") . '</font></div>'; print '<div><font color="red">' . $langs->trans("AnyLineImport") . '</font></div>';

View File

@ -111,11 +111,11 @@ if ($action == 'update')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -126,9 +126,9 @@ if ($action == 'setlistsorttodo') {
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans("Error"), 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
@ -138,9 +138,9 @@ if ($action == 'setlistsortdone') {
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans("Error"), 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }

View File

@ -68,9 +68,9 @@ if ($action == 'update') {
} }
if (! $error) { if (! $error) {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -116,7 +116,7 @@ if ($action == 'update') {
$result=$accounting->fetch($accounting_account_id,null,1); $result=$accounting->fetch($accounting_account_id,null,1);
if ($result<0) { if ($result<0) {
//setEventMessage(null, $accounting->errors,'errors'); //setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>'; $msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
} else { } else {

View File

@ -51,8 +51,8 @@ if ($action == "confirm_update") {
$error = 0; $error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) { if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors'); setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++; $error ++;
} }
@ -61,7 +61,7 @@ if ($action == "confirm_update") {
$result = $book->fetch($id); $result = $book->fetch($id);
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
$book->numero_compte = $numero_compte; $book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers; $book->code_tiers = $code_tiers;
@ -69,20 +69,20 @@ if ($action == "confirm_update") {
$book->debit = $debit; $book->debit = $debit;
$book->credit = $credit; $book->credit = $credit;
if (! empty($debit)) { if (floatval($debit)!=0.0) {
$book->montant = $debit; $book->montant = $debit;
$book->sens = 'D'; $book->sens = 'D';
} }
if (! empty($credit)) { if (floatval($credit)!=0.0) {
$book->montant = $credit; $book->montant = $credit;
$book->sens = 'C'; $book->sens = 'C';
} }
$result = $book->update(); $result = $book->update();
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
setEventMessage($langs->trans('Saved'), 'mesgs'); setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = ''; $action = '';
} }
} }
@ -93,7 +93,7 @@ else if ($action == "add") {
$error = 0; $error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) { if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors'); setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++; $error ++;
} }
@ -124,9 +124,9 @@ else if ($action == "add") {
$result = $book->create_std($user); $result = $book->create_std($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
setEventMessage($langs->trans('Saved'), 'mesgs'); setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = ''; $action = '';
} }
} }
@ -140,11 +140,11 @@ else if ($action == "confirm_delete") {
$piece_num = $book->piece_num; $piece_num = $book->piece_num;
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
$result = $book->delete($user); $result = $book->delete($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} }
} }
$action = ''; $action = '';
@ -168,9 +168,9 @@ else if ($action == "confirm_create") {
$result = $book->create_std($user); $result = $book->create_std($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
setEventMessage($langs->trans('Saved'), 'mesgs'); setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = ''; $action = '';
$piece_num = $book->piece_num; $piece_num = $book->piece_num;
} }
@ -246,7 +246,7 @@ if ($action == 'create') {
$book = new BookKeeping($db); $book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num); $result = $book->fetch_per_mvt($piece_num);
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} }
if (! empty($book->piece_num)) { if (! empty($book->piece_num)) {
@ -277,7 +277,7 @@ if ($action == 'create') {
$result = $book->fetch_all_per_mvt($piece_num); $result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) { if ($result < 0) {
setEventMessage($book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
print load_fiche_titre($langs->trans("ListeMvts")); print load_fiche_titre($langs->trans("ListeMvts"));
@ -372,4 +372,4 @@ if ($action == 'create') {
} }
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -74,7 +74,7 @@ if ($action == 'delbookkeeping') {
$result = $object->delete_by_importkey($import_key); $result = $object->delete_by_importkey($import_key);
Header("Location: list.php"); Header("Location: list.php");
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} // Export } // Export
@ -86,7 +86,7 @@ else if ($action == 'export_csv') {
$object = new BookKeeping($db); $object = new BookKeeping($db);
$result = $object->export_bookkeping('ebp'); $result = $object->export_bookkeping('ebp');
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
foreach ( $object->linesexport as $line ) { foreach ( $object->linesexport as $line ) {

View File

@ -54,7 +54,7 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG); dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) { if (! $resql) {
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
} else { } else {
header("Location: ./lines.php"); header("Location: ./lines.php");

View File

@ -83,10 +83,10 @@ if ($action == 'validatehistory') {
if (! $resql1) { if (! $resql1) {
$error ++; $error ++;
$db->rollback(); $db->rollback();
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
$db->commit(); $db->commit();
setEventMessage($langs->trans('Dispatched'), 'mesgs'); setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
} }
} }
@ -346,4 +346,4 @@ print "</table>\n";
print '</td></tr></table>'; print '</td></tr></table>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -109,14 +109,14 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
if (! $resql1) { if (! $resql1) {
$error ++; $error ++;
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
if (! $error) { if (! $error) {
$db->commit(); $db->commit();
setEventMessage($langs->trans('Save'), 'mesgs'); setEventMessages($langs->trans('Save'), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
} }

View File

@ -343,7 +343,7 @@ if ($action == 'writeBookKeeping')
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
// Third party // Third party
@ -420,13 +420,13 @@ if ($action == 'writeBookKeeping')
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
if (empty($error)) { if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs'); setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
} }
} }
// Export // Export

View File

@ -185,7 +185,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -215,7 +215,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -246,14 +246,14 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
} }
if (empty($error)) { if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs'); setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
} }
} }

View File

@ -220,7 +220,7 @@ if ($action == 'writebookkeeping')
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -250,7 +250,7 @@ if ($action == 'writebookkeeping')
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -282,14 +282,14 @@ if ($action == 'writebookkeeping')
$result = $bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
} }
if (empty($error)) { if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs'); setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
} }
} }

View File

@ -55,7 +55,7 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
dol_syslog('accountancy/supplier/card.php:: $sql=' . $sql); dol_syslog('accountancy/supplier/card.php:: $sql=' . $sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) { if (! $resql) {
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
} else { } else {
header("Location: ./lines.php"); header("Location: ./lines.php");

View File

@ -79,10 +79,10 @@ if ($action == 'validatehistory') {
if (! $resql1) { if (! $resql1) {
$error ++; $error ++;
$db->rollback(); $db->rollback();
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
$db->commit(); $db->commit();
setEventMessage($langs->trans('Dispatched'), 'mesgs'); setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
} }
} }

View File

@ -115,14 +115,14 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
if (! $resql1) { if (! $resql1) {
$error ++; $error ++;
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
if (! $error) { if (! $error) {
$db->commit(); $db->commit();
setEventMessage($langs->trans('Save'), 'mesgs'); setEventMessages($langs->trans('Save'), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
} }

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org> * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -69,11 +69,11 @@ if ($action == 'update' || $action == 'add')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -60,11 +60,11 @@ if ($action == 'update')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 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>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
@ -133,7 +133,7 @@ if (empty($reshook))
if ($userid != $user->id && $userid != $object->user_id) if ($userid != $user->id && $userid != $object->user_id)
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors'); setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
} }
} }
@ -169,7 +169,7 @@ if (empty($reshook))
$thirdparty=new Societe($db); $thirdparty=new Societe($db);
$thirdparty->fetch($socid); $thirdparty->fetch($socid);
$error++; $error++;
setEventMessage($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), 'errors'); setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), null, 'errors');
} }
} }
@ -195,12 +195,12 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans($nuser->error), 'errors'); setEventMessages($langs->trans($nuser->error), null, 'errors');
} }
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->errors, $object->error, 'errors');
} }
} }
@ -216,13 +216,13 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans($company->error), 'errors'); setEventMessages($langs->trans($company->error), null, 'errors');
setEventMessage($company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} }
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -236,7 +236,7 @@ if (empty($reshook))
$result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent")); $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
$langs->load("mails"); $langs->load("mails");
setEventMessage($langs->trans("MailSuccessfulySent", $from, $object->email)); setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
} }
} }
@ -257,12 +257,12 @@ if (empty($reshook))
if ($morphy != 'mor' && empty($lastname)) { if ($morphy != 'mor' && empty($lastname)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
} }
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
} }
// Create new object // Create new object
@ -352,7 +352,7 @@ if (empty($reshook))
$newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0) if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0)
{ {
setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors'); setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} }
else else
{ {
@ -368,7 +368,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessage("ErrorBadImageFormat", 'errors'); setEventMessages("ErrorBadImageFormat", null, 'errors');
} }
} }
else else
@ -397,9 +397,9 @@ if (empty($reshook))
else else
{ {
if ($object->error) { if ($object->error) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$action=''; $action='';
} }
@ -485,14 +485,14 @@ if (empty($reshook))
// Check parameters // Check parameters
if (empty($morphy) || $morphy == "-1") { if (empty($morphy) || $morphy == "-1") {
$error++; $error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors');
} }
// Test si le login existe deja // Test si le login existe deja
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
if (empty($login)) { if (empty($login)) {
$error++; $error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Login")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors');
} }
else { else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";
@ -503,32 +503,32 @@ if (empty($reshook))
if ($num) { if ($num) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorLoginAlreadyExists",$login), 'errors'); setEventMessages($langs->trans("ErrorLoginAlreadyExists",$login), null, 'errors');
} }
} }
if (empty($pass)) { if (empty($pass)) {
$error++; $error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Password")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors');
} }
} }
if ($morphy != 'mor' && empty($lastname)) { if ($morphy != 'mor' && empty($lastname)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
} }
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
} }
if (! ($typeid > 0)) { // Keep () before ! if (! ($typeid > 0)) { // Keep () before !
$error++; $error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
} }
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorBadEMail",$email), 'errors'); setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors');
} }
$public=0; $public=0;
if (isset($public)) $public=1; if (isset($public)) $public=1;
@ -554,9 +554,9 @@ if (empty($reshook))
$db->rollback(); $db->rollback();
if ($object->error) { if ($object->error) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$action = 'create'; $action = 'create';
@ -609,7 +609,7 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} }
@ -617,9 +617,9 @@ if (empty($reshook))
{ {
$error++; $error++;
if ($object->error) { if ($object->error) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -654,7 +654,7 @@ if (empty($reshook))
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
else else
@ -662,9 +662,9 @@ if (empty($reshook))
$error++; $error++;
if ($object->error) { if ($object->error) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessage($object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$action=''; $action='';
} }
@ -683,7 +683,7 @@ if (empty($reshook))
{ {
if (!$mailmanspip->del_to_spip($object)) if (!$mailmanspip->del_to_spip($object))
{ {
setEventMessage($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, 'errors'); setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
} }
} }
} }
@ -694,7 +694,7 @@ if (empty($reshook))
{ {
if (!$mailmanspip->add_to_spip($object)) if (!$mailmanspip->add_to_spip($object))
{ {
setEventMessage($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, 'errors'); setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
} }
} }
} }

View File

@ -110,7 +110,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error); $errmsg=$langs->trans($company->error);
setEventMessage($company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} }
else else
{ {
@ -131,7 +131,7 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id) if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), 'errors'); setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
} }
} }
@ -167,7 +167,7 @@ if ($action == 'setsocid')
$thirdparty=new Societe($db); $thirdparty=new Societe($db);
$thirdparty->fetch(GETPOST('socid','int')); $thirdparty->fetch(GETPOST('socid','int'));
$error++; $error++;
setEventMessage($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), 'errors'); setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), null, 'errors');
} }
} }

View File

@ -1575,7 +1575,7 @@ class Adherent extends CommonObject
$picto='user'; $picto='user';
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); if ($withpicto) $result.=($link.img_object('', $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend; $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
return $result; return $result;

View File

@ -72,12 +72,12 @@ if ($action == 'dolibarr2ldap')
if ($result >= 0) if ($result >= 0)
{ {
setEventMessage($langs->trans("MemberSynchronized")); setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
$db->commit(); $db->commit();
} }
else else
{ {
setEventMessage($ldap->error, 'errors'); setEventMessages($ldap->errors, $ldap->error, 'errors');
$db->rollback(); $db->rollback();
} }
} }

View File

@ -202,7 +202,7 @@ if ($resql)
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
} }
// Filter on categories // Filter on categories

View File

@ -86,12 +86,12 @@ if ($action == "save" && empty($cancel))
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"),null, 'errors');
$db->rollback(); $db->rollback();
} }
} }

View File

@ -72,7 +72,7 @@ if ($actionsave)
if (! empty($src) && ! dol_is_url($src)) if (! empty($src) && ! dol_is_url($src))
{ {
setEventMessage($langs->trans("ErrorParamMustBeAnUrl"),'errors'); setEventMessages($langs->trans("ErrorParamMustBeAnUrl"), null, 'errors');
$error++; $error++;
$errorsaved++; $errorsaved++;
break; break;
@ -104,12 +104,12 @@ if ($actionsave)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
if (empty($errorsaved)) setEventMessage($langs->trans("Error"),'errors'); if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -54,12 +54,12 @@ if ($actionsave)
if ($i >= 4) if ($i >= 4)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("SaveFailed"), 'errors'); setEventMessages($langs->trans("SaveFailed"), null, 'errors');
} }
} }

View File

@ -6,8 +6,8 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -54,11 +54,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -96,13 +96,13 @@ if ($action == 'specimen')
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -116,11 +116,11 @@ if ($action == 'set_ASKPRICESUPPLIER_DRAFT_WATERMARK')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -134,11 +134,11 @@ if ($action == 'set_ASKPRICESUPPLIER_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -150,11 +150,11 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -178,12 +178,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -56,11 +56,11 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -97,11 +97,11 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'msgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -111,11 +111,11 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -162,7 +162,7 @@ foreach($dirbarcode as $reldir)
{ {
$filebis=$reg[1]; $filebis=$reg[1];
// Chargement de la classe de codage // Loading encoding class
require_once $newdir.$file; require_once $newdir.$file;
$classname = "mod".ucfirst($filebis); $classname = "mod".ucfirst($filebis);
$module = new $classname($db); $module = new $classname($db);

View File

@ -85,7 +85,7 @@ if ($action == 'add') {
} }
else else
{ {
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$error++; $error++;
} }
} }
@ -121,7 +121,7 @@ if ($action == 'add') {
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) if (! $resql)
{ {
setEventMessage($db->lasterror(), 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$error++; $error++;
} }
} }

View File

@ -36,16 +36,19 @@ $action = GETPOST("action");
/* /*
* Actions * Actions
*/ */
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("url"), 'chaine', 0, '', $conf->entity); $result=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
if ($result >= 0) $result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
if ($result1 >= 0 && $result2 >= 0)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -73,13 +76,22 @@ $var=true;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="120">'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td valign="top">'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("ClickToDialUseTelLink").'</td><td>';
print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
print '<br>';
print $langs->trans("ClickToDialUseTelLinkDesc");
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("DefaultLink").'</td><td>'; print $langs->trans("DefaultLink").'</td><td>';
print '<input size="92" type="text" name="url" value="'.$conf->global->CLICKTODIAL_URL.'"><br>'; print '<input size="92" type="text" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
print '<br>'; print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>'; print $langs->trans("ClickToDialUrlDesc").'<br>';
print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__'; print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -64,11 +64,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -106,13 +106,13 @@ else if ($action == 'specimen')
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -137,12 +137,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -196,11 +196,11 @@ else if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -214,11 +214,11 @@ else if ($action == 'set_ORDER_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -228,9 +228,9 @@ else if ($action=="setshippableiconinlist") {
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) { if (! $error) {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -243,11 +243,28 @@ else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Activate ask for warehouse
else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -630,6 +647,36 @@ else
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
} }
// Ask for warehouse during order
if ($conf->stock->enabled)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
}
else
{
if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
}
print '</td></tr>';
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 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>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
@ -125,19 +125,19 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$tmparray=explode(':',$result); $tmparray=explode(':',$result);
setEventMessage($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]),'errors'); setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
} }
else else
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorFailedToSaveFile"),'errors'); setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} }
} }
else else
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors'); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
} }
} }
} }
@ -230,7 +230,7 @@ if ($action == 'addthumb')
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors'); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING); dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
} }
} }
@ -238,7 +238,7 @@ if ($action == 'addthumb')
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors'); setEventMessages($langs->trans("ErrorFileDoesNotExists",$_GET["file"]), null, 'errors');
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING); dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
} }
} }

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
@ -87,11 +87,11 @@ if ($action == 'update')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -55,12 +55,12 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
if (empty($constname)) if (empty($constname))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
$error++; $error++;
} }
if ($constvalue == '') if ($constvalue == '')
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Value")), null, 'errors');
$error++; $error++;
} }
@ -68,7 +68,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
{ {
if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0) if (dolibarr_set_const($db, $constname, $constvalue, 'chaine', 1, $constnote, $entity) >= 0)
{ {
setEventMessage($langs->trans("RecordSaved")); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action=""; $action="";
$constname=""; $constname="";
$constvalue=""; $constvalue="";
@ -99,7 +99,7 @@ if (! empty($consts) && $action == 'update')
} }
} }
} }
if ($nbmodified > 0) setEventMessage($langs->trans("RecordSaved")); if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
$action=''; $action='';
} }
@ -122,7 +122,7 @@ if (! empty($consts) && $action == 'delete')
} }
} }
} }
if ($nbdeleted > 0) setEventMessage($langs->trans("RecordDeleted")); if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
$action=''; $action='';
} }
@ -131,7 +131,7 @@ if ($action == 'delete')
{ {
if (dolibarr_del_const($db, $rowid, $entity) >= 0) if (dolibarr_del_const($db, $rowid, $entity) >= 0)
{ {
setEventMessage($langs->trans("RecordDeleted")); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
else else
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> /* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -59,11 +59,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -101,13 +101,13 @@ else if ($action == 'specimen') // For contract
} }
else else
{ {
setEventMessage($obj->error,'errors'); setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -132,12 +132,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -194,11 +194,11 @@ else if ($action == 'set_other')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
@ -34,6 +34,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$langs->load("errors"); $langs->load("errors");
@ -465,6 +466,9 @@ if ($id == 11)
'fichinter' => $langs->trans('InterventionCard') 'fichinter' => $langs->trans('InterventionCard')
); );
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
complete_elementList_with_modules($elementList);
asort($elementList); asort($elementList);
$sourceList = array( $sourceList = array(
'internal' => $langs->trans('Internal'), 'internal' => $langs->trans('Internal'),
@ -506,7 +510,7 @@ if ($id == 10)
} }
// Actions ajout ou modification d'une entree dans un dictionnaire de donnee // Actions add or modify an entry into a dictionary
if (GETPOST('actionadd') || GETPOST('actionmodify')) if (GETPOST('actionadd') || GETPOST('actionmodify'))
{ {
$listfield=explode(',',$tabfield[$id]); $listfield=explode(',',$tabfield[$id]);
@ -518,8 +522,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1; $ok=1;
foreach ($listfield as $f => $value) foreach ($listfield as $f => $value)
{ {
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes'))) continue; // For some pages, country is not mandatory if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue; if ($value == 'color' && empty($_POST['color'])) continue;
@ -544,20 +548,20 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible'; if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder'; if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
setEventMessage($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
} }
} }
// Other checks // Other checks
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) { if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
$ok=0; $ok=0;
setEventMessage($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'),'errors'); setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
} }
if (isset($_POST["code"])) if (isset($_POST["code"]))
{ {
if ($_POST["code"]=='0') if ($_POST["code"]=='0')
{ {
$ok=0; $ok=0;
setEventMessage($langs->transnoentities('ErrorCodeCantContainZero'),'errors'); setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
} }
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{ {
@ -574,10 +578,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
else else
{ {
$ok=0; $ok=0;
setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
} }
} }
if ($id == 3 && ! is_numeric($_POST["code"]))
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
}
// Clean some parameters // Clean some parameters
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0 if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0 if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
@ -633,13 +642,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql); $result = $db->query($sql);
if ($result) // Add is ok if ($result) // Add is ok
{ {
setEventMessage($langs->transnoentities("RecordSaved")); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST=array('id'=>$id); // Clean $_POST array, we keep only $_POST=array('id'=>$id); // Clean $_POST array, we keep only
} }
else else
{ {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessage($langs->transnoentities("ErrorRecordAlreadyExists"),'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} }
else { else {
dol_print_error($db); dol_print_error($db);
@ -683,7 +692,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) if (! $resql)
{ {
setEventMessage($db->error(),'errors'); setEventMessage($db->error(), 'errors');
} }
} }
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
@ -707,7 +716,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{ {
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{ {
setEventMessage($langs->transnoentities("ErrorRecordIsUsedByChild"),'errors'); setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} }
else else
{ {

View File

@ -61,7 +61,7 @@ if ($action == "save")
} }
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -65,9 +65,9 @@ if ($action == 'updateMask')
if (isset($res)) if (isset($res))
{ {
if ($res > 0) if ($res > 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -77,9 +77,9 @@ else if ($action == 'set_SHIPPING_FREE_TEXT')
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if ($res > 0) if ($res > 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') else if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
@ -88,9 +88,9 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if ($res > 0) if ($res > 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
else if ($action == 'specimen') else if ($action == 'specimen')
@ -127,13 +127,13 @@ else if ($action == 'specimen')
} }
else else
{ {
setEventMessage($module->error, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"), 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -158,12 +158,12 @@ else if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -60,11 +60,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -102,13 +102,13 @@ else if ($action == 'specimen') // For fiche inter
} }
else else
{ {
setEventMessage($obj->error,'errors'); setEventMessages($module->error, $module->errors,'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -133,12 +133,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -196,11 +196,11 @@ else if ($action == 'set_EXPENSEREPORT_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -214,11 +214,11 @@ else if ($action == 'set_EXPENSEREPORT_DRAFT_WATERMARK')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -69,11 +69,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -111,13 +111,13 @@ if ($action == 'specimen')
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -139,11 +139,11 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -200,11 +200,11 @@ if ($action == 'setribchq')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -218,11 +218,11 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -236,11 +236,11 @@ if ($action == 'set_INVOICE_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -254,11 +254,11 @@ if ($action == 'setforcedate')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -272,11 +272,11 @@ if ($action == 'set_FAC_AUTO_FILLJS')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
$classname = preg_replace('/\-.*$/','',$classname); $classname = preg_replace('/\-.*$/','',$classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{ {
// Chargement de la classe de numerotation // Charging the numbering class
require_once $dir.$filebis; require_once $dir.$filebis;
$module = new $classname($db); $module = new $classname($db);
@ -750,6 +750,20 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
// Add js auto fill amount on paiement form
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("JSOnPaimentBill");
print '</td><td width="60" align="center">';
print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';
$var=! $var; $var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
@ -784,20 +798,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
// Add js auto fill amount on paiement form
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("JSOnPaimentBill");
print '</td><td width="60" align="center">';
print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';
print '</table>'; print '</table>';

View File

@ -121,11 +121,11 @@ if (GETPOST('save','alpha'))
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -143,7 +143,7 @@ $var=true;
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
setEventMessage(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), 'errors'); setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors');
} }
else else
{ {

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -60,11 +60,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -102,13 +102,13 @@ else if ($action == 'specimen') // For fiche inter
} }
else else
{ {
setEventMessage($obj->error,'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -133,12 +133,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -192,11 +192,11 @@ else if ($action == 'set_FICHINTER_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -209,11 +209,11 @@ else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -226,11 +226,11 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -46,7 +46,7 @@ if ($action == 'set')
if (! $gimcdf && ! file_exists($gimcdf)) if (! $gimcdf && ! file_exists($gimcdf))
{ {
setEventMessage($langs->trans("ErrorFileNotFound",$gimcdf),'errors'); setEventMessages($langs->trans("ErrorFileNotFound",$gimcdf), null, 'errors');
$error++; $error++;
} }
@ -57,11 +57,11 @@ if ($action == 'set')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
} }

View File

@ -37,6 +37,7 @@ $langs->load("companies");
$langs->load("products"); $langs->load("products");
$langs->load("members"); $langs->load("members");
$langs->load("projects"); $langs->load("projects");
$langs->load("hrm");
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
@ -46,17 +47,21 @@ $action = GETPOST('action');
if (! defined("MAIN_MOTD")) define("MAIN_MOTD",""); if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
// List of supported permanent search area // List of supported permanent search area
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT"); $searchform=array();
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT); if (empty($conf->use_javascript_ajax))
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects")); {
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name'); $searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT", "MAIN_SEARCHFORM_EMPLOYEE");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT,$conf->global->MAIN_SEARCHFORM_EMPLOYEE);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"), $langs->trans("Users"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
}
if ($action == 'update') if ($action == 'update')
{ {
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLISTE_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity);
@ -76,13 +81,16 @@ if ($action == 'update')
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity);
/*
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_EMPLOYEE", $_POST["MAIN_SEARCHFORM_EMPLOYEE"],'chaine',0,'',$conf->entity);
*/
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity);
@ -161,19 +169,22 @@ if ($action == 'edit') // Edit
print '<br>'; print '<br>';
// Liste des zone de recherche permanantes supportees // Liste des zone de recherche permanantes supportees
print '<table summary="search" class="noborder" width="100%">'; if (! empty($searchform))
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
$var=True;
foreach ($searchform as $key => $value)
{ {
$var=!$var; print '<table summary="search" class="noborder" width="100%">';
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td colspan="2">'; print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
print $form->selectyesno($searchform[$key],$searchformconst[$key],1); $var=True;
print '</td></tr>'; foreach ($searchform as $key => $value)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td colspan="2">';
print $form->selectyesno($searchform[$key],$searchformconst[$key],1);
print '</td></tr>';
}
print '</table>';
print '<br>';
} }
print '</table>';
print '<br>';
// Other // Other
print '<table summary="edit" class="noborder" width="100%">'; print '<table summary="edit" class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>'; print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
@ -204,6 +215,12 @@ if ($action == 'edit') // Edit
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Max size of short lists on customer card
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Disable javascript and ajax // Disable javascript and ajax
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableJavascript").'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DisableJavascript").'</td><td>';
@ -348,20 +365,23 @@ else // Show
print '<br>'; print '<br>';
// Liste des zone de recherches permanentes supportees // List of search forms to show
print '<table class="noborder" width="100%">'; if (! empty($searchform))
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td>'.$langs->trans("Activated").'</td><td>&nbsp;</td></tr>';
$var=true;
foreach ($searchform as $key => $value)
{ {
$var=!$var; print '<table class="noborder" width="100%">';
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td>'.yn($searchformconst[$key]).'</td>'; print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td>'.$langs->trans("Activated").'</td><td>&nbsp;</td></tr>';
print '<td align="left">'.$langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key])); $var=true;
print '</td></tr>'; foreach ($searchform as $key => $value)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$searchformtitle[$key].'</td><td>'.yn($searchformconst[$key]).'</td>';
print '<td align="left">';
if (! empty($searchformmodule[$key])) print $langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key]));
print '</td></tr>';
}
print '</table>';
print '<br>';
} }
print '</table>';
print '<br>';
// Other // Other
$var=true; $var=true;
@ -385,6 +405,11 @@ else // Show
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print "</tr>"; print "</tr>";
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLISTE_LIMIT . '</td>';
print '<td width="20">&nbsp;</td>';
print "</tr>";
// Disable javascript/ajax // Disable javascript/ajax
$var=!$var; $var=!$var;

View File

@ -63,7 +63,7 @@ if ($action == 'setvalue' && $user->admin)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
@ -89,10 +89,9 @@ $head = ldap_prepare_head();
// Test si fonction LDAP actives // Test si fonction LDAP actives
if (! function_exists("ldap_connect")) if (! function_exists("ldap_connect"))
{ {
setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"));
$var=true; $var=true;
$form=new Form($db); $form=new Form($db);
@ -101,6 +100,8 @@ $form=new Form($db);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Liste de synchro actives // Liste de synchro actives
@ -135,7 +136,7 @@ if (! empty($conf->societe->enabled))
print '</td><td>'.$langs->trans("LDAPDnContactActiveExample").'</td></tr>'; print '</td><td>'.$langs->trans("LDAPDnContactActiveExample").'</td></tr>';
} }
// Synchro adherentt active // Synchro member active
if (! empty($conf->adherent->enabled)) if (! empty($conf->adherent->enabled))
{ {
$var=!$var; $var=!$var;
@ -143,6 +144,7 @@ if (! empty($conf->adherent->enabled))
$arraylist=array(); $arraylist=array();
$arraylist['0']=$langs->trans("No"); $arraylist['0']=$langs->trans("No");
$arraylist['1']=$langs->trans("DolibarrToLDAP"); $arraylist['1']=$langs->trans("DolibarrToLDAP");
$arraylist['ldap2dolibarr']=$langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
print $form->selectarray('activemembers',$arraylist,$conf->global->LDAP_MEMBER_ACTIVE); print $form->selectarray('activemembers',$arraylist,$conf->global->LDAP_MEMBER_ACTIVE);
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>'; print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
} }
@ -239,12 +241,12 @@ print '</td><td>secret</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>'; print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>'; print '</form>';
print '</div>';
print '<br>'; print '<br>';

View File

@ -77,7 +77,7 @@ if ($action == 'setvalue' && $user->admin)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
@ -92,6 +92,8 @@ if ($action == 'setvalue' && $user->admin)
* View * View
*/ */
$form=new Form($db);
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP'); llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP');
$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>';
@ -102,7 +104,7 @@ $head = ldap_prepare_head();
// Test si fonction LDAP actives // Test si fonction LDAP actives
if (! function_exists("ldap_connect")) if (! function_exists("ldap_connect"))
{ {
setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup")); dol_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"));
@ -114,8 +116,6 @@ print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$form=new Form($db);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$var=true; $var=true;
@ -263,16 +263,16 @@ print '</td><td>&nbsp;</td>';
print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_COUNTRY"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked':'')."></td>"; print '<td align="right"><input type="radio" name="key" value="LDAP_CONTACT_FIELD_COUNTRY"'.($conf->global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked':'')."></td>";
print '</tr>'; print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table>'; print '</table>';
print info_admin($langs->trans("LDAPDescValues"));
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>'; print '</form>';
print '</div>';
print info_admin($langs->trans("LDAPDescValues"));
/* /*
* Test de la connexion * Test de la connexion

View File

@ -68,7 +68,7 @@ if ($action == 'setvalue' && $user->admin)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
@ -93,7 +93,7 @@ $head = ldap_prepare_head();
// Test si fonction LDAP actives // Test si fonction LDAP actives
if (! function_exists("ldap_connect")) if (! function_exists("ldap_connect"))
{ {
setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup")); dol_fiche_head($head, 'groups', $langs->trans("LDAPSetup"));
@ -177,16 +177,16 @@ print '</td><td>'.$langs->trans("LDAPFieldGroupMembersExample").'</td>';
print '<td align="right"><input type="radio" name="key" value="LDAP_GROUP_FIELD_GROUPMEMBERS"'.(($conf->global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked':'')."></td>"; print '<td align="right"><input type="radio" name="key" value="LDAP_GROUP_FIELD_GROUPMEMBERS"'.(($conf->global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked':'')."></td>";
print '</tr>'; print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table>'; print '</table>';
print info_admin($langs->trans("LDAPDescValues"));
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>'; print '</form>';
print '</div>';
print info_admin($langs->trans("LDAPDescValues"));
/* /*
* Test de la connexion * Test de la connexion

View File

@ -53,6 +53,7 @@ if ($action == 'setvalue' && $user->admin)
if (! dolibarr_set_const($db, 'LDAP_MEMBER_DN',GETPOST("user"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_DN',GETPOST("user"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FILTER',GETPOST("filterconnection"),'chaine',0,'',$conf->entity)) $error++;
// Members // Members
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FULLNAME',GETPOST("fieldfullname"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FULLNAME',GETPOST("fieldfullname"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN',GETPOST("fieldlogin"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_LOGIN',GETPOST("fieldlogin"),'chaine',0,'',$conf->entity)) $error++;
@ -92,7 +93,7 @@ if ($action == 'setvalue' && $user->admin)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
@ -107,6 +108,8 @@ if ($action == 'setvalue' && $user->admin)
* View * View
*/ */
$form=new Form($db);
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP'); llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP');
$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>';
@ -117,9 +120,12 @@ $head = ldap_prepare_head();
// Test si fonction LDAP actives // Test si fonction LDAP actives
if (! function_exists("ldap_connect")) if (! function_exists("ldap_connect"))
{ {
setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head($head, 'members', $langs->trans("LDAPSetup")); dol_fiche_head($head, 'members', $langs->trans("LDAPSetup"));
@ -127,11 +133,6 @@ print $langs->trans("LDAPDescMembers").'<br>';
print '<br>'; print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$form=new Form($db);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$var=true; $var=true;
@ -156,6 +157,14 @@ print '</td><td>'.$langs->trans("LDAPMemberObjectClassListExample").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
// Filter, used to filter search
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_MEMBER_FILTER.'">';
print '</td><td>'.$langs->trans("LDAPFilterConnectionExample").'</td>';
print '<td></td>';
print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -377,15 +386,16 @@ print '</td><td>&nbsp;</td>';
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print '</tr>'; print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table>'; print '</table>';
print info_admin($langs->trans("LDAPDescValues"));
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>'; print '</form>';
print '</div>';
print info_admin($langs->trans("LDAPDescValues"));
/* /*
@ -454,6 +464,7 @@ if (function_exists("ldap_connect"))
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -63,7 +63,7 @@ if ($action == 'setvalue' && $user->admin)
if (! dolibarr_set_const($db, 'LDAP_FIELD_MAIL',GETPOST("fieldmail"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MAIL',GETPOST("fieldmail"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
@ -78,7 +78,7 @@ if ($action == 'setvalue' && $user->admin)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
@ -93,6 +93,8 @@ if ($action == 'setvalue' && $user->admin)
* Visu * Visu
*/ */
$form=new Form($db);
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP'); llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:M&oacute;dulo_LDAP');
$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>';
@ -103,21 +105,22 @@ $head = ldap_prepare_head();
// Test si fonction LDAP actives // Test si fonction LDAP actives
if (! function_exists("ldap_connect")) if (! function_exists("ldap_connect"))
{ {
setEventMessage($langs->trans("LDAPFunctionsNotAvailableOnPHP"),'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head($head, 'users', $langs->trans("LDAPSetup")); dol_fiche_head($head, 'users', $langs->trans("LDAPSetup"));
print $langs->trans("LDAPDescUsers").'<br>'; print $langs->trans("LDAPDescUsers").'<br>';
print '<br>'; print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$form=new Form($db);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$var=true; $var=true;
@ -141,8 +144,7 @@ print '</td><td>'.$langs->trans("LDAPUserObjectClassListExample").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
// Filtre // Filter, used to filter search
//Utilise pour filtrer la recherche
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFilterConnection").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">'; print '<input size="48" type="text" name="filterconnection" value="'.$conf->global->LDAP_FILTER_CONNECTION.'">';
@ -281,16 +283,16 @@ print '</td><td>'.$langs->trans("LDAPFieldSidExample").'</td>';
print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked':'')."></td>"; print '<td align="right"><input type="radio" name="key" value="LDAP_FIELD_SID"'.(($conf->global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked':'')."></td>";
print '</tr>'; print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table>'; print '</table>';
print '</form>';
print '</div>';
print info_admin($langs->trans("LDAPDescValues")); print info_admin($langs->trans("LDAPDescValues"));
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>';
/* /*
* Test de la connexion * Test de la connexion
@ -392,7 +394,7 @@ if (function_exists("ldap_connect"))
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED, $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
$conf->global->LDAP_FIELD_PHONE, $conf->global->LDAP_FIELD_PHONE,
$conf->global->LDAP_FIELD_FAX, $conf->global->LDAP_FIELD_FAX,
$conf->global->LDAP_FIELD_SKYPE, $conf->global->LDAP_FIELD_SKYPE,
$conf->global->LDAP_FIELD_MOBILE, $conf->global->LDAP_FIELD_MOBILE,
$conf->global->LDAP_FIELD_MAIL, $conf->global->LDAP_FIELD_MAIL,
$conf->global->LDAP_FIELD_TITLE, $conf->global->LDAP_FIELD_TITLE,
@ -427,7 +429,7 @@ if (function_exists("ldap_connect"))
} }
else else
{ {
setEventMessage($ldap->error, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }
print "<br>\n"; print "<br>\n";

View File

@ -43,7 +43,7 @@ if ($action == 'update')
|| $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC) || $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC)
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), 'errors'); setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden",$MAXDEC), null, 'errors');
} }
if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0 if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0
@ -52,7 +52,7 @@ if ($action == 'update')
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessage($langs->trans("ErrorNegativeValueNotAllowed"), 'errors'); setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
} }
if ($_POST["MAIN_ROUNDING_RULE_TOT"]) if ($_POST["MAIN_ROUNDING_RULE_TOT"])
@ -61,7 +61,7 @@ if ($action == 'update')
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessage($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), 'errors'); setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
} }
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -58,11 +58,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -75,11 +75,11 @@ if ($action == 'set_DELIVERY_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -117,13 +117,13 @@ if ($action == 'specimen')
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -148,12 +148,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -61,11 +61,11 @@ if ($action == 'update')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -64,12 +64,12 @@ if ($action == 'setvalue')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -65,11 +65,11 @@ if ($action == 'update' || $action == 'add')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -99,7 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if (! isValidEmail($email)) if (! isValidEmail($email))
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorBadEMail",$email),'errors'); setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors');
} }
else else
{ {
@ -118,11 +118,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage($mailmanspip->error,'errors'); setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
} }
else else
{ {
setEventMessage($langs->trans("MailmanCreationSuccess")); setEventMessages($langs->trans("MailmanCreationSuccess"), null);
} }
} }
if ($action == 'testunsubscribe') if ($action == 'testunsubscribe')
@ -131,11 +131,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessage($mailmanspip->error,'errors'); setEventMessages($mailmanspip->error,$mailmanspip->errors,'errors');
} }
else else
{ {
setEventMessage($langs->trans("MailmanDeletionSuccess")); setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
} }
} }
} }
@ -156,12 +156,15 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head(); $head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$var=true; $var=true;
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$link.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
@ -200,21 +203,30 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
}); });
</script>'; </script>';
form_constantes($constantes,1); form_constantes($constantes,2);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>'; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
} }
else else
{ {
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$link.=img_$langs->trans("Activate") //$link.=img_$langs->trans("Activate")
$link.=img_picto($langs->trans("Disabled"),'switch_off'); $link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>'; $link.='</a>';
print load_fiche_titre($langs->trans('MailmanTitle'), $link,''); print load_fiche_titre($langs->trans('MailmanTitle'), $link,'');
dol_fiche_end();
} }
dol_fiche_end();
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{ {

View File

@ -123,7 +123,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
$result = dol_delete_file($pathtodelete,1); $result = dol_delete_file($pathtodelete,1);
if ($result) if ($result)
{ {
setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); setEventMessages(array($langs->trans("FileWasRemoved"), $filetodelete), null, 'mesgs');
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);
@ -169,19 +169,19 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
if (empty($_POST["frommail"])) if (empty($_POST["frommail"]))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")), null, 'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($sendto)) if (empty($sendto))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTo")), null, 'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (! $error) if (! $error)
{ {
// Le message est-il en html // Is the message in HTML?
$msgishtml=0; // Message is not HTML $msgishtml=0; // Message is not HTML
if ($action == 'sendhtml') $msgishtml=1; // Force message to HTML if ($action == 'sendhtml') $msgishtml=1; // Force message to HTML
@ -209,11 +209,11 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
if ($result) if ($result)
{ {
setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2))); setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result,'errors'); setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
} }
$action=''; $action='';
@ -677,7 +677,7 @@ else
$errormsg .= ' - '.$mail->error; $errormsg .= ' - '.$mail->error;
} }
setEventMessage($errormsg, 'errors'); setEventMessages($errormsg, null, 'errors');
} }
print '<br>'; print '<br>';
} }

View File

@ -102,8 +102,7 @@ if ($action == 'update' && empty($_POST["cancel"]))
else else
{ {
$error++; $error++;
//TODO: Translate setEventMessages($langs->trans("FailedToInitializeMenu").' '.$key, null, 'errors');
setEventMessage('Failed to initialize menu '.$key.'.', 'errors');
$db->rollback(); $db->rollback();
} }
} }

View File

@ -78,16 +78,16 @@ if ($action == 'update')
$result=$menu->update($user); $result=$menu->update($user);
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans("RecordModifiedSuccessfully")); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} }
else else
{ {
setEventMessage($menu->error, 'errors'); setEventMessages($menu->error, $menu->errors, 'errors');
} }
} }
else else
{ {
setEventMessage($menu->error, 'errors'); setEventMessages($menu->error, $menu->errors, 'errors');
} }
$_GET["menuId"] = $_POST['menuId']; $_GET["menuId"] = $_POST['menuId'];
$action = "edit"; $action = "edit";
@ -135,37 +135,37 @@ if ($action == 'add')
$error=0; $error=0;
if (! $error && ! $_POST['menu_handler']) if (! $error && ! $_POST['menu_handler'])
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MenuHandler")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MenuHandler")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['type']) if (! $error && ! $_POST['type'])
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['url']) if (! $error && ! $_POST['url'])
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Url")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Url")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && ! $_POST['titre']) if (! $error && ! $_POST['titre'])
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Title")), 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && $_POST['menuId'] && $_POST['type'] == 'top') if (! $error && $_POST['menuId'] && $_POST['type'] == 'top')
{ {
setEventMessage($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), 'errors'); setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left') if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left')
{ {
setEventMessage($langs->trans("ErrorLeftMenuMustHaveAParentId"), 'errors'); setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
@ -204,7 +204,7 @@ if ($action == 'add')
else else
{ {
$action = 'create'; $action = 'create';
setEventMessage($menu->error, 'errors'); setEventMessages($menu->error, $menu->errors, 'errors');
} }
} }
} }
@ -222,7 +222,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
$this->db->commit(); $this->db->commit();
llxHeader(); llxHeader();
setEventMessage($langs->trans("MenuDeleted")); setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
llxFooter(); llxFooter();
exit ; exit ;
} }

View File

@ -186,7 +186,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes')
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("MenuDeleted")); setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler); header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler);
exit ; exit ;
@ -359,7 +359,7 @@ if ($conf->use_javascript_ajax)
else else
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFeatureNeedJavascript"), 'errors'); setEventMessages($langs->trans("ErrorFeatureNeedJavascript"), null, 'errors');
} }
print '<br>'; print '<br>';

View File

@ -66,7 +66,7 @@ $familyinfo=array(
if ($action == 'set' && $user->admin) if ($action == 'set' && $user->admin)
{ {
$result=activateModule($value); $result=activateModule($value);
if ($result) setEventMessage($result, 'errors'); if ($result) setEventMessages($result, null, 'errors');
header("Location: modules.php?mode=".$mode); header("Location: modules.php?mode=".$mode);
exit; exit;
} }
@ -74,7 +74,7 @@ if ($action == 'set' && $user->admin)
if ($action == 'reset' && $user->admin) if ($action == 'reset' && $user->admin)
{ {
$result=unActivateModule($value); $result=unActivateModule($value);
if ($result) setEventMessage($result, 'errors'); if ($result) setEventMessages($result, null, 'errors');
header("Location: modules.php?mode=".$mode); header("Location: modules.php?mode=".$mode);
exit; exit;
} }
@ -125,7 +125,7 @@ foreach ($modulesdir as $dir)
if (! empty($modNameLoaded[$modName])) if (! empty($modNameLoaded[$modName]))
{ {
$mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>"; $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
setEventMessage($mesg, 'warnings'); setEventMessages($mesg, null, 'warnings');
dol_syslog($mesg, LOG_ERR); dol_syslog($mesg, LOG_ERR);
continue; continue;
} }
@ -141,7 +141,7 @@ foreach ($modulesdir as $dir)
if (! $objMod->numero > 0) if (! $objMod->numero > 0)
{ {
dol_syslog('a module descriptor must have a numero property', LOG_ERR); dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
} }
$j = $objMod->numero; $j = $objMod->numero;

View File

@ -93,13 +93,13 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

370
htdocs/admin/oauth.php Normal file
View File

@ -0,0 +1,370 @@
<?php
/* Copyright (C) 2015 Frederic France <frederic.france@free.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/admin/oauth.php
* \ingroup oauth
* \brief Setup page to configure oauth access api
*/
require '../main.inc.php';
// required Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$langs->load("admin");
$langs->load("oauth");
// Security check
if (!$user->admin)
accessforbidden();
$action = GETPOST('action', 'alpha');
// Supported OAUTH
$supportedoauth2array=array('OAUTH_GOOGLE_NAME');
// API access parameters OAUTH
$list = array (
array(
'OAUTH_AMAZON_NAME',
'OAUTH_AMAZON_ID',
'OAUTH_AMAZON_SECRET',
),
array(
'OAUTH_BITBUCKET_NAME',
'OAUTH_BITBUCKET_ID',
'OAUTH_BITBUCKET_SECRET',
),
array(
'OAUTH_BITLY_NAME',
'OAUTH_BITLY_ID',
'OAUTH_BITLY_SECRET',
),
array(
'OAUTH_BITRIX24_NAME',
'OAUTH_BITRIX24_ID',
'OAUTH_BITRIX24_SECRET',
),
array(
'OAUTH_BOX_NAME',
'OAUTH_BOX_ID',
'OAUTH_BOX_SECRET',
),
array(
'OAUTH_BUFFER_NAME',
'OAUTH_BUFFER_ID',
'OAUTH_BUFFER_SECRET',
),
array(
'OAUTH_DAILYMOTION_NAME',
'OAUTH_DAILYMOTION_ID',
'OAUTH_DAILYMOTION_SECRET',
),
array(
'OAUTH_DEVIANTART_NAME',
'OAUTH_DEVIANTART_ID',
'OAUTH_DEVIANTART_SECRET',
),
array(
'OAUTH_DROPBOX_NAME',
'OAUTH_DROPBOX_ID',
'OAUTH_DROPBOX_SECRET',
),
array(
'OAUTH_ETSY_NAME',
'OAUTH_ETSY_ID',
'OAUTH_ETSY_SECRET',
),
array(
'OAUTH_EVEONLINE_NAME',
'OAUTH_EVEONLINE_ID',
'OAUTH_EVEONLINE_SECRET',
),
array(
'OAUTH_FACEBOOK_NAME',
'OAUTH_FACEBOOK_ID',
'OAUTH_FACEBOOK_SECRET',
),
array(
'OAUTH_FITBIT_NAME',
'OAUTH_FITBIT_ID',
'OAUTH_FITBIT_SECRET',
),
array(
'OAUTH_FIVEHUNDREDPX_NAME',
'OAUTH_FIVEHUNDREDPX_ID',
'OAUTH_FIVEHUNDREDPX_SECRET',
),
array(
'OAUTH_FLICKR_NAME',
'OAUTH_FLICKR_ID',
'OAUTH_FLICKR_SECRET',
),
array(
'OAUTH_FOURSQUARE_NAME',
'OAUTH_FOURSQUARE_ID',
'OAUTH_FOURSQUARE_SECRET',
),
array(
'OAUTH_GITHUB_NAME',
'OAUTH_GITHUB_ID',
'OAUTH_GITHUB_SECRET',
),
array(
'OAUTH_GOOGLE_NAME',
'OAUTH_GOOGLE_ID',
'OAUTH_GOOGLE_SECRET',
),
array(
'OAUTH_HUBIC_NAME',
'OAUTH_HUBIC_ID',
'OAUTH_HUBIC_SECRET',
),
array(
'OAUTH_INSTAGRAM_NAME',
'OAUTH_INSTAGRAM_ID',
'OAUTH_INSTAGRAM_SECRET',
),
array(
'OAUTH_LINKEDIN_NAME',
'OAUTH_LINKEDIN_ID',
'OAUTH_LINKEDIN_SECRET',
),
array(
'OAUTH_MAILCHIMP_NAME',
'OAUTH_MAILCHIMP_ID',
'OAUTH_MAILCHIMP_SECRET',
),
array(
'OAUTH_MICROSOFT_NAME',
'OAUTH_MICROSOFT_ID',
'OAUTH_MICROSOFT_SECRET',
),
array(
'OAUTH_NEST_NAME',
'OAUTH_NEST_ID',
'OAUTH_NEST_SECRET',
),
array(
'OAUTH_NETATMO_NAME',
'OAUTH_NETATMO_ID',
'OAUTH_NETATMO_SECRET',
),
array(
'OAUTH_PARROTFLOWERPOWER_NAME',
'OAUTH_PARROTFLOWERPOWER_ID',
'OAUTH_PARROTFLOWERPOWER_SECRET',
),
array(
'OAUTH_PAYPAL_NAME',
'OAUTH_PAYPAL_ID',
'OAUTH_PAYPAL_SECRET',
),
array(
'OAUTH_POCKET_NAME',
'OAUTH_POCKET_ID',
'OAUTH_POCKET_SECRET',
),
array(
'OAUTH_QUICKBOOKS_NAME',
'OAUTH_QUICKBOOKS_ID',
'OAUTH_QUICKBOOKS_SECRET',
),
array(
'OAUTH_REDDIT_NAME',
'OAUTH_REDDIT_ID',
'OAUTH_REDDIT_SECRET',
),
array(
'OAUTH_REDMINE_NAME',
'OAUTH_REDMINE_ID',
'OAUTH_REDMINE_SECRET',
),
array(
'OAUTH_RUNKEEPER_NAME',
'OAUTH_RUNKEEPER_ID',
'OAUTH_RUNKEEPER_SECRET',
),
array(
'OAUTH_SCOOPIT_NAME',
'OAUTH_SCOOPIT_ID',
'OAUTH_SCOOPIT_SECRET',
),
array(
'OAUTH_SOUNDCLOUD_NAME',
'OAUTH_SOUNDCLOUD_ID',
'OAUTH_SOUNDCLOUD_SECRET',
),
array(
'OAUTH_SPOTIFY_NAME',
'OAUTH_SPOTIFY_ID',
'OAUTH_SPOTIFY_SECRET',
),
array(
'OAUTH_STRAVA_NAME',
'OAUTH_STRAVA_ID',
'OAUTH_STRAVA_SECRET',
),
array(
'OAUTH_TUMBLR_NAME',
'OAUTH_TUMBLR_ID',
'OAUTH_TUMBLR_SECRET',
),
array(
'OAUTH_TWITTER_NAME',
'OAUTH_TWITTER_ID',
'OAUTH_TWITTER_SECRET',
),
array(
'OAUTH_USTREAM_NAME',
'OAUTH_USTREAM_ID',
'OAUTH_USTREAM_SECRET',
),
array(
'OAUTH_VIMEO_NAME',
'OAUTH_VIMEO_ID',
'OAUTH_VIMEO_SECRET',
),
array(
'OAUTH_YAHOO_NAME',
'OAUTH_YAHOO_ID',
'OAUTH_YAHOO_SECRET',
),
array(
'OAUTH_YAMMER_NAME',
'OAUTH_YAMMER_ID',
'OAUTH_YAMMER_SECRET',
),
);
/*
* Actions
*/
if ($action == 'update')
{
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname[1], 'alpha');
if (!dolibarr_set_const($db, $constname[1], $constvalue, 'chaine', 0, '', $conf->entity))
$error++;
$constvalue = GETPOST($constname[2], 'alpha');
if (!dolibarr_set_const($db, $constname[2], $constvalue, 'chaine', 0, '', $conf->entity))
$error++;
}
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null);
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
llxHeader();
$form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ConfigOAuth'),$linkback,'title_setup');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
/*
* Parameters
*/
dol_fiche_head(array(), '', '', 0, 'technic');
print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
print '<table class="noborder" width="100%">';
$var = true;
foreach ($list as $key)
{
$supported=0;
if (in_array($key[0], $supportedoauth2array)) $supported=1;
if (! $supported) continue; // show only supported
print '<tr class="liste_titre">';
// Api Name
$label = $langs->trans($key[0]);
print '<td colspan="2">'.$label.'</td></tr>';
if ($supported)
{
$redirect_uri=$urlwithroot.'/core/modules/oauth/getgoogleoauthcallback.php';
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td><input style="width: 80%" type"text" name="uri'.$key[0].'" value="'.$redirect_uri.'">';
print '</td></tr>';
}
else
{
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
print '</td></tr>';
}
// Api Id
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>';
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->$key[1].'">';
print '</td></tr>';
// Api Secret
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<td><label for="'.$key[2].'">'.$langs->trans($key[2]).'</label></td>';
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->$key[2].'">';
print '</td></tr>';
}
print '</table>'."\n";
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
print '</form>';
llxFooter();
$db->close();

View File

@ -66,7 +66,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("OrderLines"); $textobject=$langs->transnoentitiesnoconv("Orders");
llxHeader('',$langs->trans("OrdersSetup")); llxHeader('',$langs->trans("OrdersSetup"));

View File

@ -54,11 +54,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -130,7 +130,7 @@ foreach ($dirmodels as $reldir)
$classname = preg_replace('/\-.*$/','',$classname); $classname = preg_replace('/\-.*$/','',$classname);
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{ {
// Chargement de la classe de numerotation // Charging the numbering class
require_once $dir.$filebis; require_once $dir.$filebis;
$module = new $classname($db); $module = new $classname($db);

View File

@ -62,7 +62,8 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit; exit;
} }
@ -135,6 +136,12 @@ if ($action == 'edit') // Edit
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Hide VAT Intra on address
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1);
print '</td></tr>';
// Show prof id 1 in address into pdf // Show prof id 1 in address into pdf
$var=!$var; $var=!$var;
if (! $noCountryCode) if (! $noCountryCode)
@ -223,12 +230,6 @@ if ($action == 'edit') // Edit
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1); print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
print '</td></tr>'; print '</td></tr>';
// Hide Tva Intra on adress
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1);
print '</td></tr>';
//Desc //Desc
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
@ -247,6 +248,12 @@ if ($action == 'edit') // Edit
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1); print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
print '</td></tr>'; print '</td></tr>';
// Place customer adress to the ISO location
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1);
print '</td></tr>';
print '</table>'; print '</table>';
@ -303,6 +310,12 @@ else // Show
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Hide Intra VAT on address
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
print '</td></tr>';
// Show prof id 1 in address into pdf // Show prof id 1 in address into pdf
$var=!$var; $var=!$var;
if (! $noCountryCode) if (! $noCountryCode)
@ -386,13 +399,6 @@ else // Show
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
// Hide any PDF informations
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
print '</td></tr>';
// Encrypt and protect PDF // Encrypt and protect PDF
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -421,11 +427,11 @@ else // Show
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Hide Tva Intra on adress // Hide any PDF informations
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1); print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
print '</td></tr>'; print '</td></tr>';
//Desc //Desc
$var=!$var; $var=!$var;
@ -445,6 +451,10 @@ else // Show
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1); print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
print '</td></tr>'; print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -81,12 +81,12 @@ if ($action == "set")
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -59,11 +59,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -101,13 +101,13 @@ if ($action == 'specimen')
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -121,11 +121,11 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -139,11 +139,11 @@ if ($action == 'set_PROPOSAL_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -155,11 +155,11 @@ if ($action == 'setdefaultduration')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -171,11 +171,11 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -199,12 +199,12 @@ if ($action == 'setModuleOptions')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -44,12 +44,12 @@ if (GETPOST("action") == 'set_proxy')
{ {
if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT"))) if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT")))
{ {
setEventMessage($langs->trans("ErrorValueMustBeInteger"),'errors'); setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors');
$error++; $error++;
} }
if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT"))) if (GETPOST("MAIN_USE_RESPONSE_TIMEOUT") && ! is_numeric(GETPOST("MAIN_USE_RESPONSE_TIMEOUT")))
{ {
setEventMessage($langs->trans("ErrorValueMustBeInteger"),'errors'); setEventMessages($langs->trans("ErrorValueMustBeInteger"), null, 'errors');
$error++; $error++;
} }
@ -68,7 +68,7 @@ if (GETPOST("action") == 'set_proxy')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("RecordModifiedSuccessfully")); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} }
} }

View File

@ -0,0 +1,442 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.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/admin/receiptprinter.php
* \ingroup printing
* \brief Page to setup receipt printer
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/receiptprinter.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
$langs->load("admin");
$langs->load("receiptprinter");
if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$mode = GETPOST('mode','alpha');
$printername = GETPOST('printername', 'alpha');
$printerid = GETPOST('printerid', 'int');
$parameter = GETPOST('parameter', 'alpha');
$template = GETPOST('template', 'alpha');
$templatename = GETPOST('templatename', 'alpha');
$templateid = GETPOST('templateid', 'int');
$printer = new dolReceiptPrinter($db);
if (!$mode) $mode='config';
// used in library escpos maybe useful if php doesn't support gzdecode
if (!function_exists('gzdecode')) {
function gzdecode($data)
{
return gzinflate(substr($data,10,-8));
}
}
/*
* Action
*/
if ($action == 'addprinter' && $user->admin)
{
$error=0;
$db->begin();
if (empty($printername)) {
$error++;
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
}
if (empty($parameter)) {
setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings');
}
if (! $error)
{
$result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), $parameter);
if ($result > 0) $error++;
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("PrinterAdded",$printername), null);
}
else
{
$db->rollback();
dol_print_error($db);
}
}
$action = '';
}
if ($action == 'deleteprinter' && $user->admin)
{
$error=0;
$db->begin();
if (empty($printerid)) {
$error++;
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (! $error)
{
$result= $printer->DeletePrinter($printerid);
if ($result > 0) $error++;
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("PrinterDeleted",$printername), null);
}
else
{
$db->rollback();
dol_print_error($db);
}
}
$action = '';
}
if ($action == 'updateprinter' && $user->admin)
{
$error=0;
$db->begin();
if (empty($printerid)) {
$error++;
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (! $error)
{
$result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), $parameter, $printerid);
if ($result > 0) $error++;
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("PrinterUpdated",$printername), null);
}
else
{
$db->rollback();
dol_print_error($db);
}
}
$action = '';
}
if ($action == 'testprinter' && $user->admin)
{
$error=0;
if (empty($printerid)) {
$error++;
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
}
if (! $error)
{
// test
$ret = $printer->SendTestToPrinter($printerid);
if ($ret == 0)
{
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
}
else
{
setEventMessages($printer->error, $printer->errors, 'errors');
}
}
$action = '';
}
if ($action == 'updatetemplate' && $user->admin)
{
$error=0;
$db->begin();
if (empty($templateid)) {
$error++;
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
}
if (! $error)
{
$result= $printer->UpdateTemplate($templatename, $template, $templateid);
if ($result > 0) $error++;
if (! $error)
{
$db->commit();
setEventMessages($langs->trans("TemplateUpdated",$templatename), null);
}
else
{
$db->rollback();
dol_print_error($db);
}
}
$action = '';
}
/*
* View
*/
$form = new Form($db);
llxHeader('',$langs->trans("ReceiptPrinterSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ReceiptPrinterSetup"),$linkback,'title_setup');
$head = receiptprinteradmin_prepare_head($mode);
if ($mode == 'config' && $user->admin)
{
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
if ($action!='editprinter') {
print '<input type="hidden" name="action" value="addprinter">';
} else {
print '<input type="hidden" name="action" value="updateprinter">';
}
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
print '<th>'.$langs->trans("Parameters").'</th>';
print '<th></th>';
print '<th></th>';
print '<th></th>';
print "</tr>\n";
$ret = $printer->listprinters();
if ($ret > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
for ($line=0; $line < count($printer->listprinters); $line++) {
$var = !$var;
print '<tr '.$bc[$var].'>';
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) {
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
print '<td>'.$printer->resprint.'</td>';
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
} else {
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
switch ($printer->listprinters[$line]['fk_type']) {
case 1:
$connector = 'CONNECTOR_DUMMY';
break;
case 2:
$connector = 'CONNECTOR_FILE_PRINT';
break;
case 3:
$connector = 'CONNECTOR_NETWORK_PRINT';
break;
case 4:
$connector = 'CONNECTOR_WINDOWS_PRINT';
break;
case 5:
$connector = 'CONNECTOR_JAVA';
break;
default:
$connector = 'CONNECTOR_UNKNOWN';
break;
}
print '<td>'.$langs->trans($connector).'</td>';
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
// edit icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=editprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'">';
print img_picto($langs->trans("Edit"),'edit');
print '</a></td>';
// delete icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=deleteprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">';
print img_picto($langs->trans("Delete"),'delete');
print '</a></td>';
// test icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=config&amp;action=testprinter&amp;printerid='.$printer->listprinters[$line]['rowid'].'&amp;printername='.$printer->listprinters[$line]['name'].'">';
print img_picto($langs->trans("TestPrinter"),'printer');
print '</a></td>';
print '</tr>';
}
}
}
if ($action!='editprinter') {
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
print '<th>'.$langs->trans("Parameters").'</th>';
print '<th></th>';
print '<th></th>';
print '<th></th>';
print "</tr>\n";
print '<tr>';
print '<td><input size="50" type="text" name="printername"></td>';
$ret = $printer->selectTypePrinter();
print '<td>'.$printer->resprint.'</td>';
print '<td><input size="60" type="text" name="parameter"></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
}
print '</table>';
dol_fiche_end();
if ($action!='editprinter') {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
} else {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
}
print '</form>';
print '<div><p></div>';
dol_fiche_head();
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
}
if ($mode == 'template' && $user->admin)
{
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
if ($action!='edittemplate') {
print '<input type="hidden" name="action" value="addtemplate">';
} else {
print '<input type="hidden" name="action" value="updatetemplate">';
}
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
print $langs->trans("ReceiptPrinterTemplateDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Template").'</th>';
print '<th></th>';
print '<th></th>';
print '<th></th>';
print "</tr>\n";
$ret = $printer->listPrintersTemplates();
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
if ($ret > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
for ($line=0; $line < count($printer->listprinterstemplates); $line++) {
$var = !$var;
print '<tr '.$bc[$var].'>';
if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) {
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
print '<td><textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
print '</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
} else {
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
// edit icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=edittemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
print img_picto($langs->trans("Edit"),'edit');
print '</a></td>';
// delete icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=deletetemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print img_picto($langs->trans("Delete"),'delete');
print '</a></td>';
// test icon
print '<td><a href="'.$_SERVER['PHP_SELF'].'?mode=template&amp;action=testtemplate&amp;templateid='.$printer->listprinterstemplates[$line]['rowid'].'&amp;templatename='.$printer->listprinterstemplates[$line]['name'].'">';
print img_picto($langs->trans("TestPrinterTemplate"),'printer');
print '</a></td>';
}
print '</tr>';
}
}
print '</table>';
if ($action!='edittemplate') {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
} else {
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
}
print '</form>';
print '<div><p></div>';
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Tag").'</th>';
print '<th>'.$langs->trans("Description").'</th>';
print "</tr>\n";
for ($tag=0; $tag < count($printer->tags); $tag++) {
$var = !$var;
print '<tr '.$bc[$var].'>';
print '<td>&lt;'.$printer->tags[$tag].'&gt;</td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
print '</tr>';
}
print '</table>';
dol_fiche_end();
}
// to remove after test
$object->date_time = '2015-11-02 22:30:25';
$object->id = 1234;
$object->customer_firstname = 'John';
$object->customer_lastname = 'Deuf';
$object->vendor_firstname = 'Jim';
$object->vendor_lastname = 'Big';
$object->barcode = '3700123862396';
//$printer->sendToPrinter($object, 1, 16);
//setEventMessages($printer->error, $printer->errors, 'errors');
llxFooter();
$db->close();

View File

@ -60,11 +60,11 @@ if ($action == 'update')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -135,7 +135,7 @@ if ($action == 'activate_encryptdbpassconf')
} }
else else
{ {
setEventMessage($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)),'warnings'); setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings');
} }
} }
else if ($action == 'disable_encryptdbpassconf') else if ($action == 'disable_encryptdbpassconf')
@ -152,7 +152,7 @@ else if ($action == 'disable_encryptdbpassconf')
} }
else else
{ {
setEventMessage($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass),'warnings'); setEventMessages($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass), null, 'warnings');
} }
} }
@ -221,7 +221,7 @@ if (is_resource($handle))
{ {
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg)) if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
{ {
// Chargement de la classe de numerotation // Charging the numbering class
$classname = $reg[1]; $classname = $reg[1];
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
@ -292,6 +292,7 @@ $var=!$var;
$this->NbRepeat = $tabConf[4]; $this->NbRepeat = $tabConf[4];
$this->WithoutAmbi = $tabConf[5]; $this->WithoutAmbi = $tabConf[5];
*/ */
print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>'; print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
@ -332,13 +333,17 @@ $var=!$var;
print '<td>' . $langs->trans("NoAmbiCaracAutoGeneration")."</td>"; print '<td>' . $langs->trans("NoAmbiCaracAutoGeneration")."</td>";
print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>'; print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
print '</tr>'; print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2"></td><td width="103" align="center"><a id="linkChangePattern">'.$langs->trans("Save").'</a></td>';
print '</tr>';
print '</table>'; print '</table>';
print '<br>';
print '<table align="right">';
print '<tr><td>';
print '<a class="button" id="linkChangePattern">'.$langs->trans("Save").'</a>';
print '</td></tr>';
print '</table>';
print '<br><br>';
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print ' function getStringArg(){'; print ' function getStringArg(){';
print ' var pattern = "";'; print ' var pattern = "";';
@ -389,7 +394,7 @@ $var=!$var;
// Cryptage mot de passe // Cryptage mot de passe
print '<br>'; print '<br>';
$var=true; $var=true;
print "<form method=\"post\" action=\"security.php\">"; print "<form method=\"post\" action=\"" . $_SERVER["PHP_SELF"] . "\">";
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=\"encrypt\">"; print "<input type=\"hidden\" name=\"action\" value=\"encrypt\">";

View File

@ -86,7 +86,7 @@ else if ($action == 'updateform')
$res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity); $res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity);
$res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity); $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity);
$res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity); $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity);
if ($res3 && $res4 && $res5 && $res6) setEventMessage($langs->trans("RecordModifiedSuccessfully")); if ($res3 && $res4 && $res5 && $res6) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} }
@ -97,8 +97,8 @@ else if ($action == 'delete')
$langs->load("other"); $langs->load("other");
$file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
Header('Location: '.$_SERVER["PHP_SELF"]); Header('Location: '.$_SERVER["PHP_SELF"]);
exit; exit;
} }

View File

@ -76,7 +76,7 @@ else if ($action == 'updateform')
{ {
$res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity);
$res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity);
if ($res1 && $res2) setEventMessage($langs->trans("RecordModifiedSuccessfully")); if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
} }

View File

@ -88,25 +88,25 @@ if ($action == 'send' && ! $_POST['cancel'])
if (! empty($formsms->error)) if (! empty($formsms->error))
{ {
setEventMessage($formsms->error,'errors'); setEventMessages($formsms->error, $formsms->errors, 'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($body)) if (empty($body))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($smsfrom) || ! str_replace('+','',$smsfrom)) if (empty($smsfrom) || ! str_replace('+','',$smsfrom))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")), null, 'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($sendto) || ! str_replace('+','',$sendto)) if (empty($sendto) || ! str_replace('+','',$sendto))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")),'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")), null, 'errors');
$action='test'; $action='test';
$error++; $error++;
} }
@ -123,11 +123,11 @@ if ($action == 'send' && ! $_POST['cancel'])
if ($result) if ($result)
{ {
setEventMessage($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto)); setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("ResultKo"),'errors'); setEventMessages($langs->trans("ResultKo"), null, 'errors');
} }
$action=''; $action='';

View File

@ -54,28 +54,30 @@ if ($action == 'update' || $action == 'add')
$constname=GETPOST("constname"); $constname=GETPOST("constname");
$constvalue=GETPOST("constvalue"); $constvalue=GETPOST("constvalue");
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue=''; // Action mise a jour ou ajout d'une constante
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice if ($action == 'update' || $action == 'add')
{ {
if ($constvalue) $constvalue=0; foreach($_POST['constname'] as $key => $val)
else $constvalue=1; {
} $constname=$_POST["constname"][$key];
$constvalue=$_POST["constvalue"][$key];
$consttype=$_POST["consttype"][$key];
$constnote=$_POST["constnote"][$key];
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname]; $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
$consttype=$_POST["consttype"];
$constnote=GETPOST("constnote"); if (! $res > 0) $error++;
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity); }
if (! $res > 0) $error++; if (! $error)
{
if (! $error) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
{ }
setEventMessage($langs->trans("SetupSaved")); else
} {
else setEventMessages($langs->trans("Error"), null, 'errors');
{ }
setEventMessage($langs->trans("Error"),'errors'); }
}
} }
// Action activation d'un sous module du module adherent // Action activation d'un sous module du module adherent
@ -115,7 +117,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head(); $head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$var=true; $var=true;
@ -124,6 +125,10 @@ $var=true;
*/ */
if (! empty($conf->global->ADHERENT_USE_SPIP)) if (! empty($conf->global->ADHERENT_USE_SPIP))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
@ -139,21 +144,28 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
print '<br>'; print '<br>';
form_constantes($constantes);
print '<br>'; form_constantes($constantes,2);
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
} }
else else
{ {
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
//$link.=$langs->trans("Activate"); //$link.=$langs->trans("Activate");
$link.=img_picto($langs->trans("Disabled"),'switch_off'); $link.=img_picto($langs->trans("Disabled"),'switch_off');
$link.='</a>'; $link.='</a>';
print load_fiche_titre($langs->trans('SPIPTitle'), $link, ''); print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
dol_fiche_end();
} }
dol_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -96,12 +96,12 @@ if($action)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -141,58 +141,75 @@ $var=true;
$found=0; $found=0;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("DeStockOnBill").'</td>';
print '<td width="160" align="right">';
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
$var=!$var; print "<form method=\"post\" action=\"stock.php\">";
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("DeStockOnBill").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_CALCULATE_ON_BILL\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_BILL\">";
print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n";
$found++;
} }
else
{
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
}
print "</td>\n</tr>\n";
$found++;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("DeStockOnValidateOrder").'</td>';
print '<td width="160" align="right">';
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
$var=!$var; print "<form method=\"post\" action=\"stock.php\">";
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("DeStockOnValidateOrder").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_CALCULATE_ON_VALIDATE_ORDER\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_VALIDATE_ORDER\">";
print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n";
$found++;
} }
else
{
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
}
print "</td>\n</tr>\n";
$found++;
//if (! empty($conf->expedition->enabled))
//{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("DeStockOnShipment").'</td>';
print '<td width="160" align="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("DeStockOnShipment").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">"; print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_CALCULATE_ON_SHIPMENT\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SHIPMENT\">";
print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n";
$found++;
} }
else
{
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
}
print "</td>\n</tr>\n";
$found++;
if (! $found) /*if (! $found)
{ {
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td colspan="2">'.$langs->trans("NoModueToManageStockDecrease").'</td>'; print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
print "</tr>\n"; print "</tr>\n";
} }*/
print '</table>'; print '</table>';
@ -208,57 +225,74 @@ $var=true;
$found=0; $found=0;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnBill").'</td>';
print '<td width="160" align="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$var=!$var; print "<form method=\"post\" action=\"stock.php\">";
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnBill").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_CALCULATE_ON_SUPPLIER_BILL\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_BILL\">";
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n";
$found++;
} }
else
{
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
}
print "</td>\n</tr>\n";
$found++;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td width="160" align="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$var=!$var; print "<form method=\"post\" action=\"stock.php\">";
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER\">";
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n";
$found++;
} }
else
{
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
}
print "</td>\n</tr>\n";
$found++;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td width="160" align="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$var=!$var; print "<form method=\"post\" action=\"stock.php\">";
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER\">";
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n";
$found++;
} }
else
{
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
}
print "</td>\n</tr>\n";
$found++;
if (! $found) /*if (! $found)
{ {
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td colspan="2">'.$langs->trans("NoModueToManageStockIncrease").'</td>'; print '<td colspan="2">'.$langs->trans("NoModueToManageStockIncrease").'</td>';
print "</tr>\n"; print "</tr>\n";
} }*/
print '</table>'; print '</table>';

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -63,11 +63,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -106,13 +106,13 @@ if ($action == 'specimen') // For invoices
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -174,11 +174,11 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.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
* 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
@ -64,11 +64,11 @@ if ($action == 'updateMask')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -107,13 +107,13 @@ else if ($action == 'specimen') // For orders
} }
else else
{ {
setEventMessage($module->error,'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }

View File

@ -119,12 +119,12 @@ if ($action == 'set')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
$db->rollback(); $db->rollback();
setEventMessage($error, 'errors'); setEventMessages($error, $errors, 'errors');
} }
@ -140,11 +140,11 @@ if ($action == 'setlevel')
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -25,11 +25,15 @@
*/ */
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/geturl.lib.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("help"); $langs->load("help");
$langs->load("members"); $langs->load("members");
$youuselaststable = 0;
/* /*
* View * View
@ -42,9 +46,54 @@ print load_fiche_titre("Dolibarr",'','title_setup');
print '<div style="padding-left: 30px;">'.img_picto_common('', 'dolibarr_box.png','height="120"').'</div>'; print '<div style="padding-left: 30px;">'.img_picto_common('', 'dolibarr_box.png','height="120"').'</div>';
print '<div class="fichecenter"><div class="fichehalfleft">';
print $langs->trans("Version").' / '.$langs->trans("DolibarrLicense").':'; print $langs->trans("Version").' / '.$langs->trans("DolibarrLicense").':';
print '<ul>'; print '<ul>';
print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>'; print '<li><strong>'.DOL_VERSION.'</strong>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
{
$title=$sfurl->channel[0]->item[0]->title;
function word_limiter($text, $limit = 30, $chars = '0123456789.')
{
if (strlen( $text ) > $limit)
{
$words = str_word_count($text, 2, $chars);
$words = array_reverse($words, TRUE);
foreach($words as $length => $word) {
if ($length + strlen( $word ) >= $limit)
{
array_shift($words);
} else {
break;
}
}
$words = array_reverse($words);
$text = implode(" ", $words) . '';
}
return $text;
}
$str = word_limiter($title);
$str = preg_replace('/[^0-9\.]/', '', $str);
print ' ('.$langs->trans("LastStableVersion").': <b>'.$str.'</b>';
if (DOL_VERSION == $str)
{
$youuselaststable=1;
print $langs->trans("YouUseLastStableVersion");
}
print ')';
print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
}
print '</ul>'; print '</ul>';
//print "<br>\n"; //print "<br>\n";
@ -114,6 +163,9 @@ print '</li>';
print '</ul>'; print '</ul>';
print '</div><div class="fichehalfright">';
print $langs->trans("HelpCenter").':'; print $langs->trans("HelpCenter").':';
print '<ul>'; print '<ul>';
print '<li>'; print '<li>';
@ -122,6 +174,7 @@ print '<a target="_blank" href="'.DOL_URL_ROOT.'/support/index.php" data-ajax="f
print '</li>'; print '</li>';
print '</ul>'; print '</ul>';
print $langs->trans("Foundation").':'; print $langs->trans("Foundation").':';
print '<ul>'; print '<ul>';
@ -153,6 +206,33 @@ print '</li>';
print '</ul>'; print '</ul>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
if ($youuselaststable)
{
print '<br>';
print '<br>';
$tmp=versiondolibarrarray();
if ((empty($tmp[2]) && (strpos($tmp[1], '0') === 0)) || (strpos($tmp[2], '0') === 0))
{
print $langs->trans("TitleExampleForMajorRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMajorRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>';
}
else
{
print $langs->trans("TitleExampleForMaintenanceRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMaintenanceRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>';
}
}
llxFooter(); llxFooter();

View File

@ -98,10 +98,10 @@ if ($action == 'update') {
if (! $error) { if (! $error) {
$db->commit(); $db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -52,8 +52,8 @@ if ($action == 'delete')
{ {
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile'); $file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1); $ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action=''; $action='';
} }

View File

@ -60,8 +60,8 @@ if ($action == 'delete')
{ {
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile'); $file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1); $ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action=''; $action='';
} }
@ -357,7 +357,7 @@ if ($what == 'postgresql')
//{ //{
if ($errormsg) if ($errormsg)
{ {
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors'); setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
$resultstring=''; $resultstring='';
$resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>'; $resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
@ -368,7 +368,7 @@ if ($what == 'postgresql')
{ {
if ($what) if ($what)
{ {
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile")); setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
$resultstring='<div class="ok">'; $resultstring='<div class="ok">';
$resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>'; $resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>';
@ -379,7 +379,7 @@ if ($what == 'postgresql')
} }
else else
{ {
setEventMessage($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user)); setEventMessages($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user), null, 'mesgs');
} }
} }
//} //}

View File

@ -34,7 +34,7 @@ $action=GETPOST('action','alpha');
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
if (GETPOST('msg','alpha')) { if (GETPOST('msg','alpha')) {
setEventMessage(GETPOST('msg','alpha'), 'errors'); setEventMessages(GETPOST('msg','alpha'), null, 'errors');
} }
@ -63,7 +63,7 @@ if ($action=='install')
if (! $original_file) if (! $original_file)
{ {
$langs->load("Error"); $langs->load("Error");
setEventMessage($langs->trans("ErrorFileRequired"), 'warnings'); setEventMessages($langs->trans("ErrorFileRequired"), null, 'warnings');
$error++; $error++;
} }
else else
@ -71,7 +71,7 @@ if ($action=='install')
if (! preg_match('/\.zip/i',$original_file)) if (! preg_match('/\.zip/i',$original_file))
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), 'errors'); setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
$error++; $error++;
} }
} }
@ -99,7 +99,7 @@ if ($action=='install')
if (! empty($result['error'])) if (! empty($result['error']))
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans($result['error'],$original_file), 'errors'); setEventMessages($langs->trans($result['error'],$original_file), null, 'errors');
$error++; $error++;
} }
else else
@ -116,7 +116,7 @@ if ($action=='install')
//var_dump($modulenamedir); //var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir)) if (! dol_is_dir($modulenamedir))
{ {
setEventMessage($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), 'errors'); setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), null, 'errors');
$error++; $error++;
} }
} }
@ -128,7 +128,7 @@ if ($action=='install')
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1); $result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0) if ($result <= 0)
{ {
setEventMessage($langs->trans("ErrorFailedToCopy"), 'errors'); setEventMessages($langs->trans("ErrorFailedToCopy"), null, 'errors');
$error++; $error++;
} }
} }
@ -142,7 +142,7 @@ if ($action=='install')
if (! $error) if (! $error)
{ {
setEventMessage($langs->trans("SetupIsReadyForUse")); setEventMessages($langs->trans("SetupIsReadyForUse"), null, 'mesgs');
} }
} }

View File

@ -0,0 +1 @@

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