Merge branch 'develop' into customerinfos
This commit is contained in:
commit
cc35f2b738
@ -131,7 +131,7 @@ script:
|
||||
# - cat upgrade370380.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
|
||||
- cat upgrade380390.log
|
||||
# - cat upgrade380390.log
|
||||
- php upgrade2.php 3.8.0 3.9.0 ignoredbversion > upgrade380390-2.log
|
||||
# - cat upgrade380390-2.log
|
||||
- cd ../..
|
||||
|
||||
12
.tx/config
12
.tx/config
@ -224,6 +224,12 @@ source_file = htdocs/langs/en_US/members.lang
|
||||
source_lang = en_US
|
||||
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]
|
||||
file_filter = htdocs/langs/<lang>/opensurvey.lang
|
||||
source_file = htdocs/langs/en_US/opensurvey.lang
|
||||
@ -284,6 +290,12 @@ source_file = htdocs/langs/en_US/propal.lang
|
||||
source_lang = en_US
|
||||
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]
|
||||
file_filter = htdocs/langs/<lang>/resource.lang
|
||||
source_file = htdocs/langs/en_US/resource.lang
|
||||
|
||||
@ -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
|
||||
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
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
|
||||
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)
|
||||
@ -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
|
||||
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
|
||||
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
|
||||
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
|
||||
@ -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
|
||||
|
||||
For licenses compatibility informations:
|
||||
http://www.fsf.org/licensing/licenses/index_html
|
||||
http://www.gnu.org/licenses/licenses.en.html
|
||||
|
||||
|
||||
Copyright
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||
 
|
||||
|
||||
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.
|
||||
|
||||
@ -239,7 +239,7 @@ http://packages.qa.debian.org/t/tcpdf.html
|
||||
|
||||
##### Create/Maintain dolibarr package
|
||||
|
||||
To update dolibarr debian package when upstream version has changed
|
||||
To update dolibarr debian package when upstream (official version of external project) has changed:
|
||||
|
||||
* You can git clone debian git repo
|
||||
> git clone git.debian.org:/git/collab-maint/dolibarr.git [dolibarr-debian]
|
||||
@ -284,10 +284,10 @@ Then check/modify also the user/date signature:
|
||||
- Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
|
||||
To update dolibarr debian package when only files into debian has changed
|
||||
To update dolibarr debian package when only files into debian has changed, or if you include manually backport:
|
||||
|
||||
* Change files and commit.
|
||||
* Add a tag debian/x.y.z+dfsgw-2 (increase the last 1 into 2)
|
||||
* Add a tag debian/x.y.z+dfsgw-2 (increase the last 1 into 2, 3...)
|
||||
|
||||
|
||||
Once files has been prepared, it's time to test:
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
"ext-curl": "*",
|
||||
"ccampbell/chromephp": "^4.1",
|
||||
"ckeditor/ckeditor": "4.3.3",
|
||||
"mike42/escpos-php": "dev-master",
|
||||
"mobiledetect/mobiledetectlib": "2.8.3",
|
||||
"phpoffice/phpexcel": "1.8.0",
|
||||
"restler/framework": "^3.0",
|
||||
|
||||
66
composer.lock
generated
66
composer.lock
generated
@ -4,7 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "f441e6348ae7862942693cab10810418",
|
||||
"hash": "d88b5c84a9ea1af354d867ba2e2ab251",
|
||||
"content-hash": "85e60ec7f8ab593387c7bd10d8db860d",
|
||||
"packages": [
|
||||
{
|
||||
"name": "ccampbell/chromephp",
|
||||
@ -126,6 +127,64 @@
|
||||
"homepage": "https://github.com/firephp/firephp-core",
|
||||
"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",
|
||||
"version": "2.8.3",
|
||||
@ -424,13 +483,16 @@
|
||||
"pdf417",
|
||||
"qrcode"
|
||||
],
|
||||
"abandoned": "tecnickcom/tcpdf",
|
||||
"time": "2015-01-28 18:51:40"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"mike42/escpos-php": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/intdata/generate-facture.php
|
||||
* \brief Script de generation de donnees aleatoires pour les factures
|
||||
* \file dev/intdata/generate-invoice.php
|
||||
* \brief Script example to inject random customer invoices (for load tests)
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-commande.php
|
||||
* \brief Script de generation de donnees aleatoires pour les commandes
|
||||
* \file dev/initdata/generate-order.php
|
||||
* \brief Script example to inject random orders (for load tests)
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-produit.php
|
||||
* \brief Script de generation de donnees aleatoires pour les produits
|
||||
* \file dev/initdata/generate-product.php
|
||||
* \brief Script example to inject random products (for load tests)
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-propale.php
|
||||
* \brief Script de generation de donnees aleatoires pour les propales
|
||||
* \file dev/initdata/generate-proposal.php
|
||||
* \brief Script example to inject random proposals (for load tests)
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-societe.php
|
||||
* \brief Script de generation de donnees aleatoires pour les societes
|
||||
* \file dev/initdata/generate-thirdparty.php
|
||||
* \brief Script example to inject random thirdparties (for load tests)
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
File diff suppressed because one or more lines are too long
@ -15,6 +15,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* Get a distant dump file and load it into a mysql database
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
@ -32,9 +34,10 @@ $error=0;
|
||||
|
||||
$sourceserver=isset($argv[1])?$argv[1]:''; // user@server:/src/file
|
||||
$password=isset($argv[2])?$argv[2]:'';
|
||||
$database=isset($argv[3])?$argv[3]:'';
|
||||
$loginbase=isset($argv[4])?$argv[4]:'';
|
||||
$passwordbase=isset($argv[5])?$argv[5]:'';
|
||||
$dataserver=isset($argv[3])?$argv[3]:'';
|
||||
$database=isset($argv[4])?$argv[4]:'';
|
||||
$loginbase=isset($argv[5])?$argv[5]:'';
|
||||
$passwordbase=isset($argv[6])?$argv[6]:'';
|
||||
|
||||
// Include Dolibarr environment
|
||||
$res=0;
|
||||
@ -64,7 +67,7 @@ if (preg_match('/^(.*)@(.*):(.*)$/',$sourceserver,$reg))
|
||||
}
|
||||
if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase))
|
||||
{
|
||||
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh database loginbase passbase\n";
|
||||
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n";
|
||||
print "Return code: 0 if success, <>0 if error\n";
|
||||
print "Warning, this script may take a long time.\n";
|
||||
exit(-1);
|
||||
@ -108,14 +111,14 @@ if ($connection)
|
||||
print 'Get file '.$sourcefile.' into '.$targetdir.$targetfile."\n";
|
||||
ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile);
|
||||
|
||||
$fullcommand="cat ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
if (preg_match('/\.bz2$/',$targetfile))
|
||||
{
|
||||
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
}
|
||||
if (preg_match('/\.gz$/',$targetfile))
|
||||
{
|
||||
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
}
|
||||
print "Load dump with ".$fullcommand."\n";
|
||||
$output=array();
|
||||
|
||||
@ -450,186 +450,225 @@ else $error++;
|
||||
|
||||
|
||||
|
||||
//--------------------------------
|
||||
// Build skeleton_script.php
|
||||
//--------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// Build skeleton_script.php, skeleton_list.php and skeleton_card.php
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Read skeleton_script.php file
|
||||
$skeletonfile=$path.'skeleton_script.php';
|
||||
$sourcecontent=file_get_contents($skeletonfile);
|
||||
if (! $sourcecontent)
|
||||
$skeletonfiles=array(
|
||||
$path.'skeleton_script.php' => 'out.'.$classmin.'_script.php',
|
||||
$path.'skeleton_list.php' => 'out.'.$classmin.'_list.php',
|
||||
$path.'skeleton_card.php' => 'out.'.$classmin.'_card.php'
|
||||
);
|
||||
|
||||
foreach ($skeletonfiles as $skeletonfile => $outfile)
|
||||
{
|
||||
print "\n";
|
||||
print "Error: Failed to read skeleton sample '".$skeletonfile."'\n";
|
||||
print "Try to run script from skeletons directory.\n";
|
||||
exit;
|
||||
$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
|
||||
$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.= '&search_".$prop['field']."='.urlencode(\$search_".$prop['field'].");\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/'.preg_quote("if (\$search_field1 != '') \$params.= '&search_field1='.urlencode(\$search_field1);",'/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote("if (\$search_field2 != '') \$params.= '&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 - 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=\"'.GETPOST('".$prop['field']."').'\"></td></tr>';\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_CREATE/', $varprop, $targetcontent);
|
||||
|
||||
// LIST_OF_TD_LABEL_FIELDS_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=\"'.\$object->".$prop['field'].".'\"></td></tr>';\n";
|
||||
}
|
||||
}
|
||||
$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 --------------------
|
||||
|
||||
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;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/skeletons/skeleton_page.php
|
||||
* \file dev/skeletons/skeleton_card.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example of a php page
|
||||
* 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');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
$langs->load("mymodule");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
@ -184,7 +184,7 @@ if (empty($reshook))
|
||||
{
|
||||
// Delete OK
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1));
|
||||
header("Location: ".dol_buildpath('/mymodule/list.php',1));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -227,131 +227,10 @@ jQuery(document).ready(function() {
|
||||
</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.= '&search_field1='.urlencode($search_field1);
|
||||
$params.= '&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
|
||||
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 '<input type="hidden" name="action" value="add">';
|
||||
@ -360,10 +239,8 @@ if ($action == 'create')
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
|
||||
print '<input class="flat" type="text" size="36" name="label" value="'.$label.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// 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_CREATE
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
@ -378,17 +255,25 @@ if ($action == 'create')
|
||||
// Part to edit record
|
||||
if (($id || $ref) && $action == 'edit')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("MyModule"));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
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();
|
||||
|
||||
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 ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@ -396,12 +281,22 @@ if (($id || $ref) && $action == 'edit')
|
||||
|
||||
|
||||
// Part to show record
|
||||
if ($id && (empty($action) || $action == 'view'))
|
||||
if ($id && (empty($action) || $action == 'view' || $action == 'delete'))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("MyModule"));
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@ -420,14 +315,7 @@ if ($id && (empty($action) || $action == 'view'))
|
||||
|
||||
if ($user->rights->mymodule->delete)
|
||||
{
|
||||
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
}
|
||||
print '</div>'."\n";
|
||||
@ -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
|
||||
* Id must be 0 if object instance is a specimen
|
||||
|
||||
439
dev/skeletons/skeleton_list.php
Normal file
439
dev/skeletons/skeleton_list.php
Normal 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.= '&search_field1='.urlencode($search_field1);
|
||||
if ($search_field2 != '') $params.= '&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();
|
||||
@ -202,7 +202,7 @@ if ($resql)
|
||||
if ($sall)
|
||||
{
|
||||
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
|
||||
|
||||
@ -162,7 +162,7 @@ foreach($dirbarcode as $reldir)
|
||||
{
|
||||
$filebis=$reg[1];
|
||||
|
||||
// Chargement de la classe de codage
|
||||
// Loading encoding class
|
||||
require_once $newdir.$file;
|
||||
$classname = "mod".ucfirst($filebis);
|
||||
$module = new $classname($db);
|
||||
|
||||
@ -510,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'))
|
||||
{
|
||||
$listfield=explode(',',$tabfield[$id]);
|
||||
@ -522,8 +522,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=1;
|
||||
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' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) 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', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||
@ -581,7 +581,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
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
|
||||
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
|
||||
|
||||
@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
|
||||
$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')
|
||||
{
|
||||
// Chargement de la classe de numerotation
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
|
||||
$module = new $classname($db);
|
||||
@ -750,6 +750,20 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
|
||||
print "</td></tr>\n";
|
||||
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;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
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 '</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>';
|
||||
|
||||
|
||||
|
||||
@ -92,7 +92,6 @@ if (! function_exists("ldap_connect"))
|
||||
setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"));
|
||||
|
||||
$var=true;
|
||||
$form=new Form($db);
|
||||
@ -101,6 +100,8 @@ $form=new Form($db);
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
dol_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Liste de synchro actives
|
||||
@ -135,7 +136,7 @@ if (! empty($conf->societe->enabled))
|
||||
print '</td><td>'.$langs->trans("LDAPDnContactActiveExample").'</td></tr>';
|
||||
}
|
||||
|
||||
// Synchro adherentt active
|
||||
// Synchro member active
|
||||
if (! empty($conf->adherent->enabled))
|
||||
{
|
||||
$var=!$var;
|
||||
@ -143,6 +144,7 @@ if (! empty($conf->adherent->enabled))
|
||||
$arraylist=array();
|
||||
$arraylist['0']=$langs->trans("No");
|
||||
$arraylist['1']=$langs->trans("DolibarrToLDAP");
|
||||
$arraylist['ldap2dolibarr']=$langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
|
||||
print $form->selectarray('activemembers',$arraylist,$conf->global->LDAP_MEMBER_ACTIVE);
|
||||
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
|
||||
}
|
||||
@ -239,12 +241,12 @@ print '</td><td>secret</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
@ -92,6 +92,8 @@ if ($action == 'setvalue' && $user->admin)
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP');
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -114,8 +116,6 @@ 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%">';
|
||||
$var=true;
|
||||
|
||||
@ -263,16 +263,16 @@ print '</td><td> </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>';
|
||||
|
||||
|
||||
$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 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 '</div>';
|
||||
|
||||
print info_admin($langs->trans("LDAPDescValues"));
|
||||
|
||||
/*
|
||||
* Test de la connexion
|
||||
|
||||
@ -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 '</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 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 '</div>';
|
||||
|
||||
print info_admin($langs->trans("LDAPDescValues"));
|
||||
|
||||
/*
|
||||
* Test de la connexion
|
||||
|
||||
@ -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_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
|
||||
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++;
|
||||
@ -107,6 +108,8 @@ if ($action == 'setvalue' && $user->admin)
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP');
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -120,6 +123,9 @@ if (! function_exists("ldap_connect"))
|
||||
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"));
|
||||
|
||||
|
||||
@ -127,11 +133,6 @@ print $langs->trans("LDAPDescMembers").'<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%">';
|
||||
$var=true;
|
||||
|
||||
@ -156,6 +157,14 @@ print '</td><td>'.$langs->trans("LDAPMemberObjectClassListExample").'</td>';
|
||||
print '<td> </td>';
|
||||
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 '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -377,15 +386,16 @@ print '</td><td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
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 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 '</div>';
|
||||
|
||||
print info_admin($langs->trans("LDAPDescValues"));
|
||||
|
||||
|
||||
/*
|
||||
@ -454,6 +464,7 @@ if (function_exists("ldap_connect"))
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -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_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_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_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_SID',GETPOST("fieldsid"),'chaine',0,'',$conf->entity)) $error++;
|
||||
@ -93,6 +93,8 @@ if ($action == 'setvalue' && $user->admin)
|
||||
* Visu
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("LDAPSetup"),'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP');
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
@ -106,18 +108,19 @@ if (! function_exists("ldap_connect"))
|
||||
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"));
|
||||
|
||||
print $langs->trans("LDAPDescUsers").'<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%">';
|
||||
$var=true;
|
||||
|
||||
@ -141,8 +144,7 @@ print '</td><td>'.$langs->trans("LDAPUserObjectClassListExample").'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Filtre
|
||||
//Utilise pour filtrer la recherche
|
||||
// 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_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 '</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 '</form>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
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
|
||||
@ -392,7 +394,7 @@ if (function_exists("ldap_connect"))
|
||||
$conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
|
||||
$conf->global->LDAP_FIELD_PHONE,
|
||||
$conf->global->LDAP_FIELD_FAX,
|
||||
$conf->global->LDAP_FIELD_SKYPE,
|
||||
$conf->global->LDAP_FIELD_SKYPE,
|
||||
$conf->global->LDAP_FIELD_MOBILE,
|
||||
$conf->global->LDAP_FIELD_MAIL,
|
||||
$conf->global->LDAP_FIELD_TITLE,
|
||||
|
||||
370
htdocs/admin/oauth.php
Normal file
370
htdocs/admin/oauth.php
Normal 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();
|
||||
@ -66,7 +66,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("OrderLines");
|
||||
$textobject=$langs->transnoentitiesnoconv("Orders");
|
||||
|
||||
llxHeader('',$langs->trans("OrdersSetup"));
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ foreach ($dirmodels as $reldir)
|
||||
$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')
|
||||
{
|
||||
// Chargement de la classe de numerotation
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
@ -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_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_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
}
|
||||
@ -135,6 +136,12 @@ if ($action == 'edit') // Edit
|
||||
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>';
|
||||
|
||||
// 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
|
||||
$var=!$var;
|
||||
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 '</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
|
||||
$var=!$var;
|
||||
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 '</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>';
|
||||
|
||||
@ -303,6 +310,12 @@ else // Show
|
||||
print '<table class="noborder" width="100%">';
|
||||
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
|
||||
$var=!$var;
|
||||
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>';
|
||||
|
||||
|
||||
// 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
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
@ -421,11 +427,11 @@ else // Show
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Hide Tva Intra on adress
|
||||
$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>';
|
||||
// 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>';
|
||||
|
||||
//Desc
|
||||
$var=!$var;
|
||||
@ -445,6 +451,10 @@ else // Show
|
||||
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
|
||||
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>';
|
||||
|
||||
|
||||
442
htdocs/admin/receiptprinter.php
Normal file
442
htdocs/admin/receiptprinter.php
Normal 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&action=editprinter&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&action=deleteprinter&printerid='.$printer->listprinters[$line]['rowid'].'&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&action=testprinter&printerid='.$printer->listprinters[$line]['rowid'].'&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&action=edittemplate&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&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&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&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&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><'.$printer->tags[$tag].'></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();
|
||||
|
||||
@ -221,7 +221,7 @@ if (is_resource($handle))
|
||||
{
|
||||
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i',$file,$reg))
|
||||
{
|
||||
// Chargement de la classe de numerotation
|
||||
// Charging the numbering class
|
||||
$classname = $reg[1];
|
||||
require_once $dir.'/'.$file;
|
||||
|
||||
@ -292,6 +292,7 @@ $var=!$var;
|
||||
$this->NbRepeat = $tabConf[4];
|
||||
$this->WithoutAmbi = $tabConf[5];
|
||||
*/
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
|
||||
@ -332,13 +333,17 @@ $var=!$var;
|
||||
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 '</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 '<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 ' function getStringArg(){';
|
||||
print ' var pattern = "";';
|
||||
@ -389,7 +394,7 @@ $var=!$var;
|
||||
// Cryptage mot de passe
|
||||
print '<br>';
|
||||
$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=\"action\" value=\"encrypt\">";
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ if ($action == 'initbarcodeproducts')
|
||||
if (! is_object($modBarCodeProduct))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("NoBarcodeNumberingTemplateDefined"),'errors');
|
||||
setEventMessages($langs->trans("NoBarcodeNumberingTemplateDefined"), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -109,7 +109,7 @@ if ($action == 'initbarcodeproducts')
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
setEventMessage($langs->trans("AllBarcodeReset"),'mesgs');
|
||||
setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -160,7 +160,7 @@ if ($action == 'initbarcodeproducts')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("RecordsModified",$nbok),'mesgs');
|
||||
setEventMessages($langs->trans("RecordsModified",$nbok), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
|
||||
if (empty($forbarcode) || empty($fk_barcode_type))
|
||||
{
|
||||
setEventMessage($langs->trans("DefinitionOfBarCodeForProductNotComplete",$producttmp->getNomUrl()), 'warnings');
|
||||
setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete",$producttmp->getNomUrl()), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,7 +85,7 @@ if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty'))
|
||||
|
||||
if (empty($forbarcode) || empty($fk_barcode_type))
|
||||
{
|
||||
setEventMessage($langs->trans("DefinitionOfBarCodeForProductNotComplete",$thirdpartytmp->getNomUrl()), 'warnings');
|
||||
setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete",$thirdpartytmp->getNomUrl()), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,7 +114,7 @@ if ($action == 'builddoc')
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors');
|
||||
setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,13 +158,13 @@ if ($action == 'builddoc')
|
||||
if ($result <= 0 || ! dol_is_file($barcodeimage))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), 'errors');
|
||||
setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessage("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, 'errors');
|
||||
setEventMessages("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, null, 'errors');
|
||||
}
|
||||
} else {
|
||||
$template = 'tcpdflabel';
|
||||
|
||||
@ -42,12 +42,12 @@ if ($action == 'setvalue')
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans("Error"), 'errors');
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,12 +78,12 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
|
||||
if (! $title) {
|
||||
$error++;
|
||||
setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("BookmarkTitle")), 'errors');
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("BookmarkTitle")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $url) {
|
||||
$error++;
|
||||
setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("UrlOrLink")), 'errors');
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("UrlOrLink")), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -104,11 +104,11 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->transnoentities("WarningBookmarkAlreadyExists"), 'warnings');
|
||||
setEventMessages($langs->transnoentities("WarningBookmarkAlreadyExists"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($bookmark->error, 'errors');
|
||||
setEventMessages($bookmark->error, $bookmark->errors, 'errors');
|
||||
}
|
||||
$action = $invertedaction;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ if ($_GET["action"] == 'delete')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($bookmark->error, 'errors');
|
||||
setEventMessages($bookmark->error, $bookmark->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ if (GETPOST('action','alpha') == 'set')
|
||||
$res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",(GETPOST('CASHDESK_ID_WAREHOUSE','alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE','alpha') : ''),'chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",GETPOST('CASHDESK_NO_DECREASE_STOCK','alpha'),'chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db,"CASHDESK_DOLIBAR_RECEIPT_PRINTER", GETPOST('CASHDESK_DOLIBAR_RECEIPT_PRINTER','alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha'));
|
||||
|
||||
@ -66,12 +67,12 @@ if (GETPOST('action','alpha') == 'set')
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans("Error"), 'errors');
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,6 +170,17 @@ if (! empty($conf->service->enabled))
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Use Dolibarr Receipt Printer
|
||||
if (! empty($conf->receiptprinter->enabled))
|
||||
{
|
||||
$var=! $var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')';
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("CASHDESK_DOLIBAR_RECEIPT_PRINTER",$conf->global->CASHDESK_DOLIBAR_RECEIPT_PRINTER,1);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,8 +151,7 @@ if (empty($reshook))
|
||||
$result=$cat->del_type($object,$elementtype);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($cat->error,'errors');
|
||||
setEventMessage($cat->errors,'errors');
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,17 +198,17 @@ if (empty($reshook))
|
||||
$result=$cat->add_type($object,$elementtype);
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("WasAddedSuccessfully",$cat->label));
|
||||
setEventMessages($langs->trans("WasAddedSuccessfully",$cat->label), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings');
|
||||
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages( $cat->error, $cat->errors, 'errors' );
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,12 +101,12 @@ if ($action == 'update' && $user->rights->categorie->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($categorie->error, 'errors');
|
||||
setEventMessages($categorie->error, $categorie->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($categorie->error, 'errors');
|
||||
setEventMessages($categorie->error, $categorie->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ $cancel != $langs->trans("Cancel") &&
|
||||
else
|
||||
{
|
||||
$action = 'add';
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ $cancel != $langs->trans("Cancel") &&
|
||||
else
|
||||
{
|
||||
$action = 'edit';
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,13 +137,13 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory'
|
||||
$result=$object->add_type($newobject,$elementtype);
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref));
|
||||
setEventMessages($langs->trans("WasAddedSuccessfully",$newobject->ref), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings');
|
||||
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -96,7 +96,7 @@ $hookmanager->initHooks(array('actioncard','globalcard'));
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$listUserAssignedUpdated = false;
|
||||
// Remove user to assigned list
|
||||
if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
|
||||
{
|
||||
@ -114,6 +114,8 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
|
||||
$donotclearsession=1;
|
||||
if ($action == 'add') $action = 'create';
|
||||
if ($action == 'update') $action = 'edit';
|
||||
|
||||
$listUserAssignedUpdated = true;
|
||||
}
|
||||
|
||||
// Add user to assigned list
|
||||
@ -133,6 +135,8 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
|
||||
$donotclearsession=1;
|
||||
if ($action == 'add') $action = 'create';
|
||||
if ($action == 'update') $action = 'edit';
|
||||
|
||||
$listUserAssignedUpdated = true;
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
@ -140,7 +144,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
{
|
||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -151,7 +155,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -347,7 +351,7 @@ if ($action == 'add')
|
||||
$db->rollback();
|
||||
$langs->load("errors");
|
||||
$error=$langs->trans($object->error);
|
||||
setEventMessage($error,'errors');
|
||||
setEventMessages($error, null, 'errors');
|
||||
$action = 'create'; $donotclearsession=1;
|
||||
}
|
||||
}
|
||||
@ -551,8 +555,7 @@ if ($action == 'mupdate')
|
||||
$result=$object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
setEventMessage($object->errors,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
if (! empty($backtopage))
|
||||
@ -839,6 +842,28 @@ if ($id > 0)
|
||||
$result4=$object->fetch_userassigned();
|
||||
$result5=$object->fetch_optionals($id,$extralabels);
|
||||
|
||||
if($listUserAssignedUpdated || $donotclearsession) {
|
||||
|
||||
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
|
||||
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
|
||||
|
||||
$object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
|
||||
$object->label = GETPOST("label");
|
||||
$object->datep = $datep;
|
||||
$object->datef = $datef;
|
||||
$object->percentage = $percentage;
|
||||
$object->priority = GETPOST("priority");
|
||||
$object->fulldayevent= GETPOST("fullday")?1:0;
|
||||
$object->location = GETPOST('location');
|
||||
$object->socid = GETPOST("socid");
|
||||
$object->contactid = GETPOST("contactid",'int');
|
||||
//$object->societe->id = $_POST["socid"]; // deprecated
|
||||
//$object->contact->id = $_POST["contactid"]; // deprecated
|
||||
$object->fk_project = GETPOST("projectid",'int');
|
||||
|
||||
$object->note = GETPOST("note");
|
||||
}
|
||||
|
||||
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
|
||||
@ -202,7 +202,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (
|
||||
if ($filtert > 0 || $usergroup > 0)
|
||||
{
|
||||
$sql.= " AND (";
|
||||
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
|
||||
if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")";
|
||||
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||
$sql.= ")";
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ if ($action == 'builddoc')
|
||||
$result=$cat->write_file(GETPOST('id','int'));
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($cat->error, 'errors');
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update')
|
||||
else
|
||||
{
|
||||
$reload = 0;
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action= "edit";
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -123,8 +123,10 @@ if (empty($reshook))
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -140,7 +142,7 @@ if (empty($reshook))
|
||||
exit();
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans($object->error), 'errors');
|
||||
setEventMessages($langs->trans($object->error), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,8 +200,8 @@ if (empty($reshook))
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
||||
else setEventMessage($langs->trans($object->error), 'errors');
|
||||
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
else setEventMessages($langs->trans($object->error), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,7 +251,7 @@ if (empty($reshook))
|
||||
|
||||
$id = $object->create_from($user);
|
||||
} else {
|
||||
setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_askpricesupplier')), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_askpricesupplier')), null, 'errors');
|
||||
}
|
||||
} else {
|
||||
$object->ref = GETPOST('ref');
|
||||
@ -484,7 +486,7 @@ if (empty($reshook))
|
||||
if ($object->id > 0) {
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -674,7 +676,7 @@ if (empty($reshook))
|
||||
|
||||
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
||||
setEventMessage($mesg, 'errors');
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// Insert line
|
||||
$ref_fourn = GETPOST('fourn_ref');
|
||||
@ -716,7 +718,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -741,7 +743,7 @@ if (empty($reshook))
|
||||
|
||||
// Add buying price
|
||||
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = (GETPOST('buying_price') ? GETPOST('buying_price') : '');
|
||||
$buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
@ -774,7 +776,7 @@ if (empty($reshook))
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
|
||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
@ -823,7 +825,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -865,9 +867,9 @@ if (empty($reshook))
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret)
|
||||
setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
|
||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
else
|
||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1325,7 +1327,7 @@ if ($action == 'create')
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
if (empty($numref)) {
|
||||
$error ++;
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
|
||||
@ -2649,11 +2649,18 @@ class AskPriceSupplierLine extends CommonObject
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
}
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($this->product_type < 0) return -1;
|
||||
@ -2817,10 +2824,17 @@ class AskPriceSupplierLine extends CommonObject
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -105,7 +105,7 @@ if (empty($reshook))
|
||||
$result=$object->fetch($id);
|
||||
$object->code_compta=$_POST["customeraccountancycode"];
|
||||
$result=$object->update($object->id,$user,1,1,0);
|
||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// conditions de reglement
|
||||
@ -113,7 +113,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// mode de reglement
|
||||
@ -121,7 +121,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
@ -130,7 +130,7 @@ if (empty($reshook))
|
||||
$object->fetch($id);
|
||||
$object->tva_assuj=$_POST['assujtva_value'];
|
||||
$result=$object->update($object->id);
|
||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// set prospect level
|
||||
@ -157,7 +157,7 @@ if (empty($reshook))
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||
$result=$object->set_OutstandingBill($user);
|
||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -129,7 +129,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action='';
|
||||
@ -141,14 +141,14 @@ if (empty($reshook))
|
||||
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
|
||||
{
|
||||
// As security measure, we don't allow send from the GUI
|
||||
setEventMessage($langs->trans("MailingNeedCommand"), 'warnings');
|
||||
setEventMessage('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings');
|
||||
setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings');
|
||||
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
|
||||
setEventMessages('<textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
|
||||
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
|
||||
$action='';
|
||||
}
|
||||
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
setEventMessage($langs->trans("NotEnoughPermissions"), 'warnings');
|
||||
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
@ -351,27 +351,27 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
|
||||
setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs');
|
||||
}
|
||||
|
||||
// Loop finished, set global statut of mail
|
||||
if ($nbko > 0)
|
||||
{
|
||||
$statut=2; // Status 'sent partially' (because at least one error)
|
||||
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($nbok >= $num)
|
||||
{
|
||||
$statut=3; // Send to everybody
|
||||
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$statut=2; // Status 'sent partially' (because not send to everybody)
|
||||
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,11 +443,11 @@ if (empty($reshook))
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)));
|
||||
setEventMessages($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, 'errors');
|
||||
setEventMessages($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result, null, 'errors');
|
||||
}
|
||||
|
||||
$action='';
|
||||
@ -488,7 +488,7 @@ if (empty($reshook))
|
||||
$mesgs[] = $object->error;
|
||||
}
|
||||
|
||||
setEventMessage($mesgs, 'errors');
|
||||
setEventMessages($mesg, $mesgs, 'errors');
|
||||
$action="create";
|
||||
}
|
||||
|
||||
@ -518,7 +518,7 @@ if (empty($reshook))
|
||||
$mesg = $object->error;
|
||||
}
|
||||
|
||||
setEventMessage($mesg, 'errors');
|
||||
setEventMessages($mesg, $mesgs, 'errors');
|
||||
$action="";
|
||||
}
|
||||
|
||||
@ -544,7 +544,7 @@ if (empty($reshook))
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_remove_file_process($_POST['removedfile'],0);
|
||||
dol_remove_file_process($_POST['removedfile'],0,0); // We really delete file linked to mailing
|
||||
|
||||
$action="edit";
|
||||
}
|
||||
@ -582,7 +582,7 @@ if (empty($reshook))
|
||||
$mesgs[] =$object->error;
|
||||
}
|
||||
|
||||
setEventMessage($mesgs, 'errors');
|
||||
setEventMessages($mesg, $mesgs, 'errors');
|
||||
$action="edit";
|
||||
}
|
||||
else
|
||||
@ -597,7 +597,7 @@ if (empty($reshook))
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->valid($user);
|
||||
setEventMessage($langs->trans("MailingSuccessfullyValidated"));
|
||||
setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
@ -628,7 +628,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -764,18 +764,18 @@ else
|
||||
// You ensure that every user is using its own SMTP server.
|
||||
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
|
||||
$linktoadminemailend='</a>';
|
||||
setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings');
|
||||
setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 'warnings');
|
||||
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), 'warnings');
|
||||
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
|
||||
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
|
||||
$_GET["action"]='';
|
||||
}
|
||||
else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
|
||||
{
|
||||
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
|
||||
// on affiche donc juste un message
|
||||
setEventMessage($langs->trans("MailingNeedCommand"), 'warnings');
|
||||
setEventMessage('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', 'warnings');
|
||||
setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings');
|
||||
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
|
||||
setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
|
||||
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
|
||||
$_GET["action"]='';
|
||||
}
|
||||
else
|
||||
@ -1093,7 +1093,10 @@ else
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
print "\n";
|
||||
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
|
||||
@ -1103,6 +1106,9 @@ else
|
||||
|
||||
// Print mail content
|
||||
print load_fiche_titre($langs->trans("EMail"),'','');
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Subject
|
||||
@ -1168,7 +1174,9 @@ else
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
|
||||
|
||||
@ -80,7 +80,7 @@ if ($action == 'add')
|
||||
//print $dir."\n<br>";
|
||||
dol_syslog("Scan directory ".$dir." for modules");
|
||||
|
||||
// Chargement de la classe
|
||||
// Loading Class
|
||||
$file = $dir."/".$module.".modules.php";
|
||||
$classname = "mailing_".$module;
|
||||
|
||||
@ -100,24 +100,24 @@ if ($action == 'add')
|
||||
}
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs');
|
||||
setEventMessages($langs->trans("XTargetsAdded",$result), null, 'mesgs');
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
if ($result == 0)
|
||||
{
|
||||
setEventMessage($langs->trans("WarningNoEMailsAdded"),'warnings');
|
||||
setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings');
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($langs->trans("Error").($obj->error?' '.$obj->error:''),'errors');
|
||||
setEventMessages($langs->trans("Error").($obj->error?' '.$obj->error:''), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('clearlist'))
|
||||
{
|
||||
// Chargement de la classe
|
||||
// Loading Class
|
||||
$obj = new MailingTargets($db);
|
||||
$obj->clear_target($id);
|
||||
|
||||
@ -267,7 +267,7 @@ if ($object->fetch($id) >= 0)
|
||||
// Loop on each submodule
|
||||
foreach($modulenames as $modulename)
|
||||
{
|
||||
// Chargement de la classe
|
||||
// Loading Class
|
||||
$file = $dir.$modulename.".modules.php";
|
||||
$classname = "mailing_".$modulename;
|
||||
require_once $file;
|
||||
|
||||
@ -83,7 +83,7 @@ if (is_resource($handle))
|
||||
$modulename=$reg[1];
|
||||
if ($modulename == 'example') continue;
|
||||
|
||||
// Chargement de la classe
|
||||
// Loading Class
|
||||
$file = $dir."/".$modulename.".modules.php";
|
||||
$classname = "mailing_".$modulename;
|
||||
require_once $file;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2010-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -131,7 +131,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (! GETPOST('socid', 3))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -141,7 +141,7 @@ if (empty($reshook))
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
} else {
|
||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
||||
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ if (empty($reshook))
|
||||
exit();
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans($object->error), 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,8 +211,8 @@ if (empty($reshook))
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
||||
else setEventMessage($langs->trans($object->error), 'errors');
|
||||
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
else setEventMessages($langs->trans($object->error), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ if (empty($reshook))
|
||||
|
||||
$id = $object->create_from($user);
|
||||
} else {
|
||||
setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), null, 'errors');
|
||||
}
|
||||
} else {
|
||||
$object->ref = GETPOST('ref');
|
||||
@ -507,7 +507,7 @@ if (empty($reshook))
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ if (empty($reshook))
|
||||
if ($object->id > 0) {
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -859,8 +859,8 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Margin
|
||||
$fournprice = (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
||||
$buyingprice = (GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $predef) : '');
|
||||
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
|
||||
$date_end = dol_mktime(0, 0, 0, GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
|
||||
@ -875,7 +875,7 @@ if (empty($reshook))
|
||||
|
||||
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
||||
setEventMessage($mesg, 'errors');
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// Insert line
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit);
|
||||
@ -929,13 +929,13 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mise a jour d'une ligne dans la propale
|
||||
// Update a line within proposal
|
||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
||||
{
|
||||
// Define info_bits
|
||||
@ -954,8 +954,8 @@ if (empty($reshook))
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
|
||||
// Add buying price
|
||||
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = (GETPOST('buying_price') ? GETPOST('buying_price') : '');
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
@ -991,7 +991,7 @@ if (empty($reshook))
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
|
||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
@ -1040,7 +1040,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1137,9 +1137,9 @@ if (empty($reshook))
|
||||
} else {
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1649,13 +1649,13 @@ if ($action == 'create')
|
||||
else if ($action == 'validate') {
|
||||
$error = 0;
|
||||
|
||||
// on verifie si l'objet est en numerotation provisoire
|
||||
// We verifie whether the object is provisionally numbering
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV') {
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
if (empty($numref)) {
|
||||
$error ++;
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
|
||||
@ -375,13 +375,15 @@ class Propal extends CommonObject
|
||||
* @param int $date_end End date of the line
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
|
||||
{
|
||||
global $mysoc;
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -400,7 +402,7 @@ class Propal extends CommonObject
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
$pa_ht=price2num($pa_ht);
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
@ -496,19 +498,12 @@ class Propal extends CommonObject
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
|
||||
|
||||
// infos marge
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
$this->line->origin_id = $origin_id;
|
||||
$this->line->origin = $origin;
|
||||
|
||||
// Mise en option de la ligne
|
||||
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
|
||||
|
||||
@ -580,7 +575,8 @@ class Propal extends CommonObject
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$a_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
||||
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
@ -660,16 +656,7 @@ class Propal extends CommonObject
|
||||
$this->line->skip_update_total = $skip_update_total;
|
||||
$this->line->fk_unit = $fk_unit;
|
||||
|
||||
// infos marge
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
$this->line->date_start=$date_start;
|
||||
@ -913,7 +900,9 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->date_start,
|
||||
$this->lines[$i]->date_end,
|
||||
$this->lines[$i]->array_options,
|
||||
$this->lines[$i]->fk_unit
|
||||
$this->lines[$i]->fk_unit,
|
||||
$this->element,
|
||||
$this->lines[$i]->id
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
@ -1068,13 +1057,17 @@ class Propal extends CommonObject
|
||||
$clonedObj->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||
$clonedObj->fk_delivery_address = '';
|
||||
|
||||
$project = new Project($db);
|
||||
if ($this->fk_project > 0 && $project->fetch($this->fk_project)) {
|
||||
if ($project->socid <= 0) $clonedObj->fk_project = $this->fk_project;
|
||||
else $clonedObj->fk_project = '';
|
||||
} else {
|
||||
$clonedObj->fk_project = '';
|
||||
}
|
||||
/*if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$project = new Project($db);
|
||||
if ($this->fk_project > 0 && $project->fetch($this->fk_project)) {
|
||||
if ($project->socid <= 0) $clonedObj->fk_project = $this->fk_project;
|
||||
else $clonedObj->fk_project = '';
|
||||
} else {
|
||||
$clonedObj->fk_project = '';
|
||||
}
|
||||
}*/
|
||||
$clonedObj->fk_project = ''; // A cloned proposal is set by default to no project.
|
||||
}
|
||||
|
||||
// reset ref_client
|
||||
@ -1399,7 +1392,10 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function update_extrafields($user)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$action='update';
|
||||
$error = 0;
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
@ -2732,7 +2728,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='', $get_params='')
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowPropal") . '</u>';
|
||||
@ -3105,6 +3101,8 @@ class PropaleLigne extends CommonObjectLine
|
||||
|
||||
dol_syslog(get_class($this)."::insert rang=".$this->rang);
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
|
||||
@ -3121,14 +3119,20 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
if (! is_numeric($this->qty)) $this->qty = 0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
}
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($this->product_type < 0) return -1;
|
||||
@ -3266,7 +3270,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
/**
|
||||
* Update propal line object into DB
|
||||
*
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
function update($notrigger=0)
|
||||
@ -3275,6 +3279,8 @@ class PropaleLigne extends CommonObjectLine
|
||||
|
||||
$error=0;
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
|
||||
@ -3293,13 +3299,19 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
if (empty($this->subprice)) $this->subprice=0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -54,12 +54,12 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($ret == 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
else if ($ret < 0)
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -75,7 +75,7 @@ else
|
||||
|
||||
|
||||
/*
|
||||
* Ajout d'un nouveau contact
|
||||
* Add a new contact
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
@ -96,16 +96,16 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bascule du statut d'un contact
|
||||
// Toggle the status of a contact
|
||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
{
|
||||
if ($object->id > 0)
|
||||
@ -114,7 +114,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
// Deletes a contact
|
||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
@ -66,11 +66,9 @@ $var=false;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchPropal").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print $langs->trans("Proposal").':</td><td><input type="text" class="flat" name="sall" size=18></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "</table></form><br>\n";
|
||||
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ if ($result)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
//sort($fieldstosearchall);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -64,7 +64,7 @@ if ($socid > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Thirdparty").'</td><td width="80%" colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("ThirdParty").'</td><td width="80%" colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
|
||||
@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
if (! $res > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFailedToLoadDiscount"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');
|
||||
}
|
||||
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors');
|
||||
setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors');
|
||||
}
|
||||
if (! $error && $discount->fk_facture_line)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors');
|
||||
setEventMessages($langs->trans("ErrorCantSplitAUsedDiscount"), null, 'errors');
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
@ -166,13 +166,13 @@ if ($action == 'setremise')
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($soc->error, 'errors');
|
||||
setEventMessages($soc->error, $soc->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($discount->error, 'errors');
|
||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ if ($socid > 0)
|
||||
$object->fetch($socid);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
* Display tabs
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
@ -300,7 +300,7 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture)
|
||||
* Liste remises fixes restant en cours (= liees a aucune facture ni ligne de facture)
|
||||
*/
|
||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||
$sql.= " rc.datec as dc, rc.description,";
|
||||
|
||||
@ -354,7 +354,7 @@ if (empty($reshook))
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit);
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
@ -733,8 +733,8 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Margin
|
||||
$fournprice = (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
||||
$buyingprice = (GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $predef) : '');
|
||||
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
|
||||
@ -833,8 +833,8 @@ if (empty($reshook))
|
||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
|
||||
// Add buying price
|
||||
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = (GETPOST('buying_price') ? GETPOST('buying_price') : '');
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Extrafields Lines
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
@ -1166,9 +1166,9 @@ if (empty($reshook))
|
||||
|
||||
|
||||
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
@ -1189,7 +1189,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut')
|
||||
else if ($action == 'swapstatut')
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
@ -1199,7 +1199,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact')
|
||||
else if ($action == 'deletecontact')
|
||||
{
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
@ -1446,7 +1446,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
@ -2009,7 +2009,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
|
||||
@ -417,7 +417,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We increment stock of product (and sub-products)
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
@ -601,7 +601,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We increment stock of product (and sub-products)
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr",$this->ref)); // price is 0, we don't want WAP to be changed
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -777,7 +777,9 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i]->pa_ht,
|
||||
$this->lines[$i]->label,
|
||||
$this->lines[$i]->array_options,
|
||||
$this->lines[$i]->fk_unit
|
||||
$this->lines[$i]->fk_unit,
|
||||
$this->element,
|
||||
$this->lines[$i]->id
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -944,22 +946,17 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
$this->id=0;
|
||||
$this->ref = '';
|
||||
$this->statut=self::STATUS_DRAFT;
|
||||
|
||||
// Clear fields
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->date = dol_now();
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
|
||||
// Set ref
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$conf->global->COMMANDE_ADDON.'.php';
|
||||
$obj = $conf->global->COMMANDE_ADDON;
|
||||
$modCommande = new $obj;
|
||||
$this->ref = $modCommande->getNextValue($objsoc,$this);
|
||||
|
||||
|
||||
// Create clone
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
@ -1011,7 +1008,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
|
||||
$this->date_commande = dol_now();
|
||||
$this->source = 0;
|
||||
|
||||
@ -1147,6 +1144,8 @@ class Commande extends CommonOrder
|
||||
* @param string $label Label
|
||||
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
@ -1156,7 +1155,7 @@ class Commande extends CommonOrder
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
@ -1275,22 +1274,15 @@ class Commande extends CommonOrder
|
||||
$this->line->total_ttc=$total_ttc;
|
||||
$this->line->product_type=$type;
|
||||
$this->line->special_code=$special_code;
|
||||
$this->line->origin=$origin;
|
||||
$this->line->origin_id=$origin_id;
|
||||
$this->line->fk_parent_line=$fk_parent_line;
|
||||
$this->line->fk_unit=$fk_unit;
|
||||
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
|
||||
// infos marge
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// TODO Ne plus utiliser
|
||||
@ -2332,6 +2324,7 @@ class Commande extends CommonOrder
|
||||
function classifyBilled()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -2509,16 +2502,7 @@ class Commande extends CommonOrder
|
||||
$this->line->skip_update_total=$skip_update_total;
|
||||
$this->line->fk_unit=$fk_unit;
|
||||
|
||||
// infos marge
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
//by external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// TODO deprecated
|
||||
@ -2655,6 +2639,7 @@ class Commande extends CommonOrder
|
||||
global $hookmanager, $conf;
|
||||
|
||||
$action='create';
|
||||
$error = 0;
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
@ -2891,7 +2876,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function LibStatut($statut,$billed,$mode)
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
//print 'x'.$statut.'-'.$billed;
|
||||
if ($mode == 0)
|
||||
{
|
||||
@ -3531,6 +3516,8 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
$error=0;
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
dol_syslog(get_class($this)."::insert rang=".$this->rang);
|
||||
|
||||
// Clean parameters
|
||||
@ -3547,13 +3534,19 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
@ -3658,6 +3651,8 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
$error=0;
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
|
||||
@ -3677,10 +3672,17 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigné et utilisé pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -67,11 +67,9 @@ $var=false;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/commande/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchOrder").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print $langs->trans("CustomerOrder").':</td><td><input type="text" class="flat" name="sall" size=18></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "</table></form><br>\n";
|
||||
|
||||
|
||||
|
||||
@ -378,19 +378,6 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->type != 2 && $object->rappro)
|
||||
{
|
||||
// If not cash account and can be reconciliate
|
||||
if ($user->rights->banque->consolidate)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action != 'addline')
|
||||
{
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
@ -409,6 +396,20 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->type != 2 && $object->rappro)
|
||||
{
|
||||
// If not cash account and can be reconciliate
|
||||
if ($user->rights->banque->consolidate)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -998,7 +998,12 @@ class Account extends CommonObject
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
else if ($mode == 'receipts')
|
||||
{
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.$this->label.$linkend;
|
||||
return $result;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
@ -587,7 +587,7 @@ if ($result)
|
||||
if ($user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked':''):($objp->rappro?' checked':'')).'">';
|
||||
print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked="checked"':''):($objp->rappro?' checked="checked"':'')).'">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -186,7 +186,7 @@ if ($resql)
|
||||
print '<br>';
|
||||
|
||||
// Show last bank receipts
|
||||
$nbmax=5;
|
||||
$nbmax=15; // We accept to show last 15 receipts (so we can have more than one year)
|
||||
$liste="";
|
||||
$sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account=".$acct->id." AND num_releve IS NOT NULL";
|
||||
@ -226,7 +226,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
||||
|
||||
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
|
||||
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):$last_releve).'" size="10">';
|
||||
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
|
||||
print '<br>';
|
||||
if ($options)
|
||||
{
|
||||
|
||||
@ -157,6 +157,7 @@ if (empty($num))
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$object->id, $sortfield, $sortorder,'',$numrows);
|
||||
@ -282,10 +283,15 @@ else
|
||||
$found=true;
|
||||
}
|
||||
|
||||
$mesprevnext ="<a href=\"releve.php?rel=prev&num=$num&ve=$ve&account=$object->id\">".img_previous()."</a> ";
|
||||
$mesprevnext.= $langs->trans("AccountStatement")." $num";
|
||||
$mesprevnext.=" <a href=\"releve.php?rel=next&num=$num&ve=$ve&account=$object->id\">".img_next()."</a>";
|
||||
print load_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0),$mesprevnext, 'title_bank.png');
|
||||
$mesprevnext='';
|
||||
$mesprevnext.='<div class="pagination"><ul>';
|
||||
$mesprevnext.='<li class="pagination"><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?rel=prev&num='.$num.'&ve='.$ve.'&account='.$object->id.'"><</a></li>';
|
||||
//$mesprevnext.=' ';
|
||||
$mesprevnext.='<li class="pagination"><span class="inactive">'.$langs->trans("AccountStatement")." ".$num.'</span></li>';
|
||||
//$mesprevnext.=' ';
|
||||
$mesprevnext.='<li class="pagination"><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?rel=next&num='.$num.'&ve='.$ve.'&account='.$object->id.'">></a></li>';
|
||||
$mesprevnext.='</ul></div>';
|
||||
print load_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0, 'receipts'), $mesprevnext, 'title_bank.png');
|
||||
print '<br>';
|
||||
|
||||
print "<form method=\"post\" action=\"releve.php\">";
|
||||
|
||||
@ -713,7 +713,8 @@ if (empty($reshook))
|
||||
// Credit note invoice
|
||||
if ($_POST['type'] == Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if (! ($_POST['fac_avoir'] > 0))
|
||||
$sourceinvoice = GETPOST('fac_avoir');
|
||||
if (! ($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE))
|
||||
{
|
||||
$error ++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
|
||||
@ -746,7 +747,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $_POST['fac_avoir'];
|
||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||
$object->type = Facture::TYPE_CREDIT_NOTE;
|
||||
|
||||
$id = $object->create($user);
|
||||
@ -1400,7 +1401,7 @@ if (empty($reshook))
|
||||
|
||||
// Margin
|
||||
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $predef) : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
|
||||
@ -1507,8 +1508,8 @@ if (empty($reshook))
|
||||
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') ? GETPOST('buying_price') : '');
|
||||
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -2046,7 +2047,7 @@ if ($action == 'create')
|
||||
$newinvoice_static->paye = $valarray ['paye'];
|
||||
|
||||
$optionsav .= '<option value="' . $key . '"';
|
||||
if ($key == $_POST['fac_avoir'])
|
||||
if ($key == GETPOST('fac_avoir'))
|
||||
$optionsav .= ' selected';
|
||||
$optionsav .= '>';
|
||||
$optionsav .= $newinvoice_static->ref;
|
||||
@ -2554,7 +2555,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1) {
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
@ -2744,17 +2746,19 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
if ($action == 'clone')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
|
||||
array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company('', 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)));
|
||||
array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)));
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('CloneInvoice'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
if (! $formconfirm) {
|
||||
if (! $formconfirm)
|
||||
{
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
@ -2844,7 +2848,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' (' . $langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)) . ')';
|
||||
}
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($object->fk_facture_source)) {
|
||||
$facusing = new Facture($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' (' . $langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)) . ')';
|
||||
@ -3698,6 +3702,15 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create a credit note
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer)
|
||||
{
|
||||
if (! $objectidnext)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&fac_avoir=' . $object->id . '&action=create&type=2">' . $langs->trans("CreateCreditNote") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
//Create next situation invoice
|
||||
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
|
||||
|
||||
@ -63,6 +63,7 @@ class Facture extends CommonInvoice
|
||||
var $author;
|
||||
var $fk_user_author;
|
||||
var $fk_user_valid;
|
||||
var $date; // Date invoice
|
||||
var $date_creation; // Creation date
|
||||
var $date_validation; // Validation date
|
||||
var $datem;
|
||||
@ -385,6 +386,8 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$newinvoiceline=$this->lines[$i];
|
||||
$newinvoiceline->fk_facture=$this->id;
|
||||
$newinvoiceline->origin = $this->element;
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id;
|
||||
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
|
||||
{
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
@ -441,8 +444,8 @@ class Facture extends CommonInvoice
|
||||
$this->lines[$i]->product_type,
|
||||
$this->lines[$i]->rang,
|
||||
$this->lines[$i]->special_code,
|
||||
'',
|
||||
0,
|
||||
$this->element,
|
||||
$this->lines[$i]->id,
|
||||
$fk_parent_line,
|
||||
$this->lines[$i]->fk_fournprice,
|
||||
$this->lines[$i]->pa_ht,
|
||||
@ -873,7 +876,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='')
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
|
||||
$result='';
|
||||
|
||||
@ -1853,7 +1856,7 @@ class Facture extends CommonInvoice
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
// We decrease stock for product
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr",$num));
|
||||
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
@ -2361,16 +2364,7 @@ class Facture extends CommonInvoice
|
||||
$this->line->situation_percent = $situation_percent;
|
||||
$this->line->fk_unit = $fk_unit;
|
||||
|
||||
// infos marge
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
// POS or external module, take lowest buying price
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($fk_product);
|
||||
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
} else {
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
}
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
if (is_array($array_options) && count($array_options)>0) {
|
||||
@ -3861,7 +3855,9 @@ class FactureLigne extends CommonInvoiceLine
|
||||
|
||||
$error=0;
|
||||
|
||||
dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG);
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
$this->desc=trim($this->desc);
|
||||
@ -3880,13 +3876,19 @@ class FactureLigne extends CommonInvoiceLine
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_prev_id)) $this->fk_prev_id = 'null';
|
||||
if (empty($this->situation_percent)) $this->situation_percent = 0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
@ -3906,14 +3908,6 @@ class FactureLigne extends CommonInvoiceLine
|
||||
}
|
||||
}
|
||||
|
||||
// POS or by external module, take lowest buying price
|
||||
if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
$productFournisseur->find_min_price_product_fournisseur($this->fk_product);
|
||||
$this->fk_fournprice = $productFournisseur->product_fourn_price_id;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans base de la ligne
|
||||
@ -4060,6 +4054,8 @@ class FactureLigne extends CommonInvoiceLine
|
||||
|
||||
$error=0;
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
// Clean parameters
|
||||
$this->desc=trim($this->desc);
|
||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||
@ -4075,16 +4071,22 @@ class FactureLigne extends CommonInvoiceLine
|
||||
if (empty($this->product_type)) $this->product_type=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (is_null($this->situation_percent)) $this->situation_percent=100;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->product_type < 0) return -1;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -415,7 +415,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
|
||||
$datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment);
|
||||
$form->select_date($datepayment,'','','',0,"add_paiement",1,1);
|
||||
$form->select_date($datepayment,'','','',0,"add_paiement",1,1,0,0,'','',$facture->date);
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('Comments').'</td></tr>';
|
||||
|
||||
|
||||
@ -779,7 +779,7 @@ print '<div class="tabsAction">';
|
||||
|
||||
if ($user->societe_id == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valide&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans('Valid').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valide&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
|
||||
if ($user->societe_id == 0 && ! empty($object->id) && $user->rights->banque->cheque)
|
||||
@ -806,6 +806,7 @@ if ($action != 'new')
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -201,7 +201,11 @@ if ($id)
|
||||
}
|
||||
}
|
||||
|
||||
// Formulaire saisie salaire
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* create mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'create')
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
@ -231,50 +235,64 @@ if ($action == 'create')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired"><label for="datep">'.$langs->trans("DatePayment").'</label></td><td>';
|
||||
// Date payment
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DatePayment','datep',1).'</td><td>';
|
||||
print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="datev">'.$langs->trans("DateValue").'</label></td><td>';
|
||||
// Date value for bank
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DateValue','datev',0).'</td><td>';
|
||||
print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Employee
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired"><label for="fk_user">'.$langs->trans("Employee").'</label></td><td>';
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Employee','fk_user',1).'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired"><label for="label">'.$langs->trans("Label").'</label></td><td><input name="label" id="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Label','label',1).'</td><td>';
|
||||
print '<input name="label" id="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired"><label for="datesp">'.$langs->trans("DateStartPeriod").'</label></td><td>';
|
||||
// Date start period
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DateStartPeriod','datesp',1).'</td><td>';
|
||||
print $form->select_date($datesp,"datesp",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired"><label for="dateep">'.$langs->trans("DateEndPeriod").'</label></td><td>';
|
||||
// Date end period
|
||||
print '<tr><td>';
|
||||
print fieldLabel('DateEndPeriod','dateep',1).'</td><td>';
|
||||
print $form->select_date($dateep,"dateep",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired"><label for="amount">'.$langs->trans("Amount").'</label></td><td><input name="amount" id="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Amount','amount',1).'</td><td>';
|
||||
print '<input name="amount" id="amount" size="10" value="'.GETPOST("amount").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired"><label for="selectaccountid">'.$langs->trans("Account").'</label></td><td>';
|
||||
print '<tr><td>';
|
||||
print fieldLabel('Account','selectaccountid',1).'</td><td>';
|
||||
$form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Type payment
|
||||
print '<tr><td class="fieldrequired"><label for="selectpaymenttype">'.$langs->trans("PaymentMode").'</label></td><td>';
|
||||
print '<tr><td>';
|
||||
print fieldLabel('PaymentMode','selectpaymenttype',1).'</td><td>';
|
||||
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
print '</td></tr>';
|
||||
|
||||
// Number
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// Number
|
||||
@ -304,7 +322,7 @@ if ($action == 'create')
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* View mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -322,8 +340,8 @@ if ($id)
|
||||
print $object->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Person
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||
// Employee
|
||||
print '<tr><td>'.$langs->trans("Employee").'</td><td>';
|
||||
$usersal=new User($db);
|
||||
$usersal->fetch($object->fk_user);
|
||||
print $usersal->getNomUrl(1);
|
||||
|
||||
@ -47,15 +47,16 @@ $search_firstname=GETPOST("search_firstname");
|
||||
$search_societe=GETPOST("search_societe");
|
||||
$search_poste=GETPOST("search_poste");
|
||||
$search_phone=GETPOST("search_phone");
|
||||
$search_phoneper=GETPOST("search_phoneper");
|
||||
$search_phonepro=GETPOST("search_phonepro");
|
||||
$search_phonemob=GETPOST("search_phonemob");
|
||||
$search_phone_perso=GETPOST("search_phone_perso");
|
||||
$search_phone_pro=GETPOST("search_phone_pro");
|
||||
$search_phone_mobile=GETPOST("search_phone_mobile");
|
||||
$search_fax=GETPOST("search_fax");
|
||||
$search_email=GETPOST("search_email");
|
||||
$search_skype=GETPOST("search_skype");
|
||||
$search_priv=GETPOST("search_priv");
|
||||
$search_categ=GETPOST("search_categ",'int');
|
||||
$search_status=GETPOST("search_status",'int');
|
||||
$search_type=GETPOST('search_type','alpha');
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
@ -77,47 +78,41 @@ $limit = $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
$contextpage='contactlist';
|
||||
$titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
|
||||
if ($type == "p")
|
||||
{
|
||||
$contextpage='contactprospectlist';
|
||||
$titre.=' ('.$langs->trans("ThirdPartyProspects").')';
|
||||
$urlfiche="card.php";
|
||||
}
|
||||
if ($type == "c")
|
||||
{
|
||||
$contextpage='contactcustomerlist';
|
||||
$titre.=' ('.$langs->trans("ThirdPartyCustomers").')';
|
||||
$urlfiche="card.php";
|
||||
}
|
||||
else if ($type == "f")
|
||||
{
|
||||
$contextpage='contactsupplierlist';
|
||||
$titre.=' ('.$langs->trans("ThirdPartySuppliers").')';
|
||||
$urlfiche="card.php";
|
||||
}
|
||||
else if ($type == "o")
|
||||
{
|
||||
$contextpage='contactotherlist';
|
||||
$titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
|
||||
$urlfiche="";
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$sall="";
|
||||
$search_firstlast_only="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_societe="";
|
||||
$search_poste="";
|
||||
$search_phone="";
|
||||
$search_phoneper="";
|
||||
$search_phonepro="";
|
||||
$search_phonemob="";
|
||||
$search_fax="";
|
||||
$search_email="";
|
||||
$search_skype="";
|
||||
$search_priv="";
|
||||
$seach_status=1;
|
||||
}
|
||||
if ($search_priv < 0) $search_priv='';
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('contact');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
@ -128,21 +123,65 @@ $fieldstosearchall = array(
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$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 (empty($reshook))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$sall="";
|
||||
$search_firstlast_only="";
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_societe="";
|
||||
$search_poste="";
|
||||
$search_phone="";
|
||||
$search_phone_perso="";
|
||||
$search_phone_pro="";
|
||||
$search_phone_mobile="";
|
||||
$search_fax="";
|
||||
$search_email="";
|
||||
$search_skype="";
|
||||
$search_priv="";
|
||||
$search_status=-1;
|
||||
}
|
||||
if ($search_priv < 0) $search_priv='';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.poste, p.email, p.skype,";
|
||||
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.tms,";
|
||||
$sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,";
|
||||
$sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql.= " co.code as country_code";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label 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."socpeople as p";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contact_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||
@ -190,17 +229,17 @@ if (strlen($search_phone))
|
||||
{
|
||||
$sql .= " AND (p.phone LIKE '%".$db->escape($search_phone)."%' OR p.phone_perso LIKE '%".$db->escape($search_phone)."%' OR p.phone_mobile LIKE '%".$db->escape($search_phone)."%')";
|
||||
}
|
||||
if (strlen($search_phoneper))
|
||||
if (strlen($search_phone_perso))
|
||||
{
|
||||
$sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phoneper)."%'";
|
||||
$sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phone_perso)."%'";
|
||||
}
|
||||
if (strlen($search_phonepro))
|
||||
if (strlen($search_phone_pro))
|
||||
{
|
||||
$sql .= " AND p.phone LIKE '%".$db->escape($search_phonepro)."%'";
|
||||
$sql .= " AND p.phone LIKE '%".$db->escape($search_phone_pro)."%'";
|
||||
}
|
||||
if (strlen($search_phonemob))
|
||||
if (strlen($search_phone_mobile))
|
||||
{
|
||||
$sql .= " AND p.phone_mobile LIKE '%".$db->escape($search_phonemob)."%'";
|
||||
$sql .= " AND p.phone_mobile LIKE '%".$db->escape($search_phone_mobile)."%'";
|
||||
}
|
||||
if (strlen($search_fax))
|
||||
{
|
||||
@ -214,7 +253,7 @@ if (strlen($search_skype)) // filtre sur skype
|
||||
{
|
||||
$sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'";
|
||||
}
|
||||
if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($type == "o") // filtre sur type
|
||||
{
|
||||
$sql .= " AND p.fk_soc IS NULL";
|
||||
@ -239,6 +278,24 @@ if (! empty($socid))
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
// 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;
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -246,6 +303,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
// Add order and limit
|
||||
if($view == "recent")
|
||||
{
|
||||
@ -263,23 +321,39 @@ dol_syslog("contact/list.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
$param ='&begin='.htmlspecialchars($begin).'&view='.htmlspecialchars($view).'&userid='.htmlspecialchars($userid).'&contactname='.htmlspecialchars($sall);
|
||||
$param.='&type='.htmlspecialchars($type).'&view='.htmlspecialchars($view).'&search_lastname='.htmlspecialchars($search_lastname).'&search_firstname='.htmlspecialchars($search_firstname).'&search_societe='.htmlspecialchars($search_societe).'&search_email='.htmlspecialchars($search_email);
|
||||
if (!empty($search_categ)) $param.='&search_categ='.htmlspecialchars($search_categ);
|
||||
if ($search_status != '') $param.='&search_status='.htmlspecialchars($search_status);
|
||||
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".htmlspecialchars($search_priv);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email);
|
||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
||||
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||
if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_town != '') $param.='&search_town='.urlencode($search_town);
|
||||
if ($search_job != '') $param.='&search_job='.urlencode($search_job);
|
||||
if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro);
|
||||
if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso);
|
||||
if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile);
|
||||
if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax);
|
||||
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
|
||||
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($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_companies.png');
|
||||
|
||||
print '<form method="post" 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="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
@ -287,7 +361,7 @@ if ($result)
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
if ($search_firstlast_only)
|
||||
{
|
||||
@ -306,75 +380,199 @@ if ($result)
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array('type'=>$type);
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$arrayfields=array(
|
||||
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'p.firstname'=>array('label'=>$langs->trans("Firsname"), 'checked'=>1),
|
||||
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
|
||||
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
|
||||
'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
|
||||
'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1),
|
||||
'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1),
|
||||
'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1),
|
||||
'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
|
||||
'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||
'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.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":"").'">';
|
||||
|
||||
// Ligne des titres
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($conf->skype->enabled)) { print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); }
|
||||
print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut", $begin, $param, 'align="center"', $sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($langs->trans("PhonePerso"),$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $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['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
// Lines for filter fields
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_lastname" size="9" value="'.dol_escape_htmltag($search_lastname).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_firstname" size="9" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="9" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '</td>';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
if (! empty($arrayfields['p.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_societe" size="9" value="'.dol_escape_htmltag($search_societe).'">';
|
||||
print '<input class="flat" type="text" name="search_lastname" size="6" value="'.dol_escape_htmltag($search_lastname).'">';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_phonepro" size="8" value="'.dol_escape_htmltag($search_phonepro).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_phonemob" size="8" value="'.dol_escape_htmltag($search_phonemob).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_fax" size="8" value="'.dol_escape_htmltag($search_fax).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_email" size="8" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
if (! empty($conf->skype->enabled))
|
||||
if (! empty($arrayfields['p.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_skype" size="8" value="'.dol_escape_htmltag($search_skype).'">';
|
||||
print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_zip" size="3" value="'.dol_escape_htmltag($search_zip).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.town']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.phone']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_phone_pro" size="6" value="'.dol_escape_htmltag($search_phone_pro).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.phone_perso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_phone_perso" size="6" value="'.dol_escape_htmltag($search_phone_perso).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.phone_mobile']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_phone_mobile" size="6" value="'.dol_escape_htmltag($search_phone_mobile).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.fax']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_fax" size="6" value="'.dol_escape_htmltag($search_fax).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.email']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_skype" size="6" value="'.dol_escape_htmltag($search_skype).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.priv']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
|
||||
print $form->selectarray('search_priv',$selectarray,$search_priv,1);
|
||||
print '</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">';
|
||||
print '</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;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['p.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
|
||||
print $form->selectarray('search_priv',$selectarray,$search_priv,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" name="button_search" class="liste_titre" 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" name="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
@ -385,8 +583,6 @@ if ($result)
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Name
|
||||
print '<td valign="middle">';
|
||||
$contactstatic->lastname=$obj->lastname;
|
||||
$contactstatic->firstname='';
|
||||
$contactstatic->id=$obj->cidp;
|
||||
@ -395,17 +591,68 @@ if ($result)
|
||||
$contactstatic->phone_pro=$obj->phone_pro;
|
||||
$contactstatic->phone_perso=$obj->phone_perso;
|
||||
$contactstatic->phone_mobile=$obj->phone_mobile;
|
||||
print $contactstatic->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
|
||||
$contactstatic->zip=$obj->zip;
|
||||
$contactstatic->town=$obj->town;
|
||||
|
||||
// Name
|
||||
if (! empty($arrayfields['p.lastname']['checked']))
|
||||
{
|
||||
print '<td valign="middle">';
|
||||
print $contactstatic->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
}
|
||||
// Firstname
|
||||
print '<td>'.dol_trunc($obj->firstname,20).'</td>';
|
||||
|
||||
// Function
|
||||
print '<td>'.dol_trunc($obj->poste,20).'</td>';
|
||||
|
||||
if (! empty($arrayfields['p.firstname']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->firstname,20).'</td>';
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->zip,20).'</td>';
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['p.town']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->town,20).'</td>';
|
||||
}
|
||||
// Function
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->poste,20).'</td>';
|
||||
}
|
||||
// Phone
|
||||
if (! empty($arrayfields['p.phone']['checked']))
|
||||
{
|
||||
print '<td>'.dol_print_phone($obj->phone_pro,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
}
|
||||
// Phone perso
|
||||
if (! empty($arrayfields['p.phone_perso']['checked']))
|
||||
{
|
||||
print '<td>'.dol_print_phone($obj->phone_perso,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
}
|
||||
// Phone mobile
|
||||
if (! empty($arrayfields['p.phone_mobile']['checked']))
|
||||
{
|
||||
print '<td>'.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
}
|
||||
// Fax
|
||||
if (! empty($arrayfields['p.fax']['checked']))
|
||||
{
|
||||
print '<td>'.dol_print_phone($obj->fax,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
}
|
||||
// EMail
|
||||
if (! empty($arrayfields['p.email']['checked']))
|
||||
{
|
||||
print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).'</td>';
|
||||
}
|
||||
// Skype
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
{
|
||||
if (! empty($conf->skype->enabled)) { print '<td>'.dol_print_skype($obj->skype,$obj->cidp,$obj->socid,'AC_SKYPE',18).'</td>'; }
|
||||
}
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->socid)
|
||||
@ -420,27 +667,53 @@ if ($result)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Phone
|
||||
print '<td>'.dol_print_phone($obj->phone_pro,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
// Phone mobile
|
||||
print '<td>'.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
// Fax
|
||||
print '<td>'.dol_print_phone($obj->fax,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
|
||||
// EMail
|
||||
print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).'</td>';
|
||||
// Skype
|
||||
if (! empty($conf->skype->enabled)) { print '<td>'.dol_print_skype($obj->skype,$obj->cidp,$obj->socid,'AC_SKYPE',18).'</td>'; }
|
||||
// Private/Public
|
||||
if (! empty($arrayfields['p.priv']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
|
||||
}
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->tms),"day").'</td>';
|
||||
|
||||
// Private/Public
|
||||
print '<td align="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
|
||||
|
||||
// Status
|
||||
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
|
||||
|
||||
// Links Add action and Export vcard
|
||||
// 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['p.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.statut']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
|
||||
}
|
||||
// Action column - Links Add action and Export vcard
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&contactid='.$obj->cidp.'&socid='.$obj->socid.'">'.img_object($langs->trans("AddAction"),"action").'</a>';
|
||||
print ' ';
|
||||
|
||||
@ -1042,7 +1042,7 @@ if ($action == 'create')
|
||||
|
||||
// Thirdparty
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('Thirdparty').'</td>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
|
||||
if ($socid>0)
|
||||
{
|
||||
print '<td colspan="2">';
|
||||
@ -1366,7 +1366,7 @@ else
|
||||
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
|
||||
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
|
||||
$sql.= " cd.fk_unit,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id;
|
||||
@ -1401,6 +1401,7 @@ else
|
||||
$productstatic->id=$objp->fk_product;
|
||||
$productstatic->type=$objp->ptype;
|
||||
$productstatic->ref=$objp->pref;
|
||||
$productstatic->entity=$objp->pentity;
|
||||
$text = $productstatic->getNomUrl(1,'',20);
|
||||
if ($objp->label)
|
||||
{
|
||||
@ -1527,6 +1528,7 @@ else
|
||||
$productstatic->id=$objp->fk_product;
|
||||
$productstatic->type=$objp->ptype;
|
||||
$productstatic->ref=$objp->pref;
|
||||
$productstatic->entity=$objp->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
print $objp->label?' - '.dol_trunc($objp->label,16):'';
|
||||
print '<br>';
|
||||
|
||||
@ -1283,10 +1283,18 @@ class Contrat extends CommonObject
|
||||
|
||||
if (empty($pa_ht)) $pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($pa_ht == 0) {
|
||||
if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$pa_ht = $pu_ht * (1 - $remise_percent / 100);
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Insertion dans la base
|
||||
@ -1456,10 +1464,17 @@ class Contrat extends CommonObject
|
||||
|
||||
if (empty($pa_ht)) $pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente
|
||||
if ($pa_ht == 0) {
|
||||
if ($pu > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$pa_ht = $pu * (1 - $remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'";
|
||||
@ -2481,12 +2496,20 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// si prix d'achat non renseigné et utilisé pour calcul des marges alors prix achat = prix vente
|
||||
if ($this->pa_ht == 0) {
|
||||
if ($this->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pa_ht = $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Update request
|
||||
|
||||
@ -79,12 +79,10 @@ if (! empty($conf->contrat->enabled))
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAContract").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap">'.$langs->trans("Ref").':</td><td><input type="text" class="flat" name="search_contract" size="18"></td>';
|
||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print '<td class="nowrap">'.$langs->trans("Contract").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "</table></form>\n";
|
||||
print "<br>";
|
||||
}
|
||||
@ -371,7 +369,7 @@ print '<br>';
|
||||
$sql = "SELECT c.ref, c.fk_soc, ";
|
||||
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
|
||||
$sql.= " s.nom as name,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -413,6 +411,7 @@ if ($resql)
|
||||
$productstatic->id=$obj->fk_product;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
$productstatic->entity=$obj->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
}
|
||||
else
|
||||
@ -449,7 +448,7 @@ print '<br>';
|
||||
// Not activated services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
|
||||
$sql.= " s.nom as name,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -493,6 +492,7 @@ if ($resql)
|
||||
$productstatic->id=$obj->fk_product;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
$productstatic->entity=$obj->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
}
|
||||
else
|
||||
@ -528,7 +528,7 @@ print '<br>';
|
||||
// Expired services
|
||||
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
|
||||
$sql.= " s.nom as name,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -573,6 +573,7 @@ if ($resql)
|
||||
$productstatic->id=$obj->fk_product;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
$productstatic->entity=$obj->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
}
|
||||
else
|
||||
|
||||
@ -190,7 +190,7 @@ if ($resql)
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
// If the user can view categories of products
|
||||
if ($conf->categorie->enabled && $user->rights->produit->lire)
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
|
||||
@ -98,7 +98,7 @@ llxHeader();
|
||||
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
|
||||
$sql.= " s.rowid as socid, s.nom as name,";
|
||||
$sql.= " cd.rowid, cd.description, cd.statut,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= " cd.date_ouverture_prevue,";
|
||||
$sql.= " cd.date_ouverture,";
|
||||
@ -225,6 +225,7 @@ if ($resql)
|
||||
$productstatic->id=$obj->pid;
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
$productstatic->entity=$obj->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
print $obj->label?' - '.dol_trunc($obj->label,16):'';
|
||||
if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);
|
||||
|
||||
@ -46,19 +46,27 @@ if ($action == 'print_file' and $user->rights->printing->read)
|
||||
|
||||
if (! empty($conf->global->{$printer->active})) {
|
||||
$subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':'');
|
||||
$errorprint = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'), $subdir);
|
||||
//if ($errorprint < 0) {
|
||||
// setEventMessage($interface->errors, 'errors');
|
||||
//}
|
||||
if ($errorprint=='') {
|
||||
setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name);
|
||||
$module = GETPOST('printer', 'alpha');
|
||||
if ($module =='commande_fournisseur') {
|
||||
$module = 'fournisseur';
|
||||
$subdir = 'commande';
|
||||
}
|
||||
$ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir);
|
||||
if ($ret > 0) {
|
||||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
if ($ret==0) {
|
||||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors);
|
||||
setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name, null);
|
||||
$printed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($printed==0) setEventMessage($langs->trans("NoActivePrintingModuleFound"));
|
||||
if ($printed==0) setEventMessages($langs->trans("NoActivePrintingModuleFound"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessage($langs->trans("NoModuleFound"), 'warning');
|
||||
setEventMessages($langs->trans("NoModuleFound"), null, 'warnings');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -42,47 +42,77 @@ $arrayresult=array();
|
||||
// Define $searchform
|
||||
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("companies");
|
||||
//$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company'));
|
||||
$arrayresult['searchintothirdparty']=array('text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("companies");
|
||||
//$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact'));
|
||||
$arrayresult['searchintocontact']=array('text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
|
||||
{
|
||||
$langs->load("products");
|
||||
//$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product'));
|
||||
$arrayresult['searchintoproduct']=array('text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
|
||||
{
|
||||
$langs->load("projects");
|
||||
//$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
|
||||
$arrayresult['searchintoprojects']=array('text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
|
||||
{
|
||||
$langs->load("members");
|
||||
//$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user'));
|
||||
$arrayresult['searchintomember']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->user->user->lire)
|
||||
{
|
||||
$langs->load("users");
|
||||
//$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
|
||||
$arrayresult['searchintouser']=array('text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintoinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire)
|
||||
{
|
||||
$arrayresult['searchintoorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire)
|
||||
{
|
||||
$arrayresult['searchintopropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierinvoice']=array('text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierorder']=array('text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->askpricesupplier->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->askpricesupplier->lire)
|
||||
{
|
||||
$arrayresult['searchintosupplierpropal']=array('text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/askpricesupplier/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire)
|
||||
{
|
||||
$arrayresult['searchintocontract']=array('text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire)
|
||||
{
|
||||
$arrayresult['searchintointervention']=array('text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?sall='.urlencode($search_boxvalue));
|
||||
}
|
||||
|
||||
|
||||
/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag
|
||||
if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read)
|
||||
{
|
||||
|
||||
@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes
|
||||
|
||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression";
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
@ -103,6 +103,7 @@ class box_produits extends ModeleBoxes
|
||||
$productstatic->ref = $objp->ref;
|
||||
$productstatic->type = $objp->fk_product_type;
|
||||
$productstatic->label = $objp->label;
|
||||
$productstatic->entity = $objp->entity;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
|
||||
@ -66,7 +66,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
|
||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,p.entity,";
|
||||
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
|
||||
@ -110,6 +110,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
$productstatic->ref = $objp->ref;
|
||||
$productstatic->type = $objp->fk_product_type;
|
||||
$productstatic->label = $objp->label;
|
||||
$productstatic->entity = $objp->entity;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
|
||||
@ -75,6 +75,7 @@ abstract class CommonDocGenerator
|
||||
'myuser_mobile'=>$user->user_mobile,
|
||||
'myuser_email'=>$user->email,
|
||||
'myuser_logo'=>$user->photo,
|
||||
'myuser_job'=>$user->job,
|
||||
'myuser_web'=>'' // url not exist in $user object
|
||||
);
|
||||
}
|
||||
|
||||
@ -1391,6 +1391,8 @@ abstract class CommonObject
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->mode_reglement_id = $id;
|
||||
// for supplier
|
||||
if (get_class($this) == 'Fournisseur') $this->mode_reglement_supplier_id = $id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -1431,6 +1433,8 @@ abstract class CommonObject
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->cond_reglement_id = $id;
|
||||
// for supplier
|
||||
if (get_class($this) == 'Fournisseur') $this->cond_reglement_supplier_id = $id;
|
||||
$this->cond_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
@ -3108,20 +3112,21 @@ abstract class CommonObject
|
||||
|
||||
$var=!$var;
|
||||
|
||||
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
||||
//if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line.
|
||||
{
|
||||
if (empty($line->fk_parent_line))
|
||||
{
|
||||
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
|
||||
$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
}
|
||||
else
|
||||
{
|
||||
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
|
||||
$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
}
|
||||
}
|
||||
else
|
||||
if (empty($reshook))
|
||||
{
|
||||
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline);
|
||||
}
|
||||
@ -3171,6 +3176,9 @@ abstract class CommonObject
|
||||
{
|
||||
$product_static = new Product($this->db);
|
||||
$product_static->fetch($line->fk_product);
|
||||
|
||||
$product_static->ref = $line->ref; //can change ref in hook
|
||||
$product_static->label = $line->label; //can change label in hook
|
||||
$text=$product_static->getNomUrl(1);
|
||||
|
||||
// Define output language and label
|
||||
@ -4176,4 +4184,66 @@ abstract class CommonObject
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* define buy price if not defined
|
||||
* set buy price = sell price if ForceBuyingPriceIfNull configured,
|
||||
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, set pmp as buyprice
|
||||
* else set min buy price as buy price
|
||||
*
|
||||
* @param float $unitPrice product unit price
|
||||
* @param float $discountPercent line discount percent
|
||||
* @param int $fk_product product id
|
||||
*
|
||||
* @return float <0 if ko, buyprice if ok
|
||||
*/
|
||||
public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$buyPrice = 0;
|
||||
|
||||
if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
{
|
||||
$buyPrice = $unitPrice * (1 - $discountPercent / 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get PMP
|
||||
if (! empty($fk_product))
|
||||
{
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch($fk_product);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error='ErrorProductIdDoesNotExists';
|
||||
return -1;
|
||||
}
|
||||
if (($product->pmp > 0))
|
||||
{
|
||||
$buyPrice = $product->pmp;
|
||||
}
|
||||
// TODO add option to set PMP of product
|
||||
}
|
||||
else if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
if (($result = $productFournisseur->find_min_price_product_fournisseur($fk_product)) > 0)
|
||||
{
|
||||
$buyPrice = $productFournisseur->fourn_price;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $productFournisseur->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $buyPrice;
|
||||
}
|
||||
}
|
||||
|
||||
601
htdocs/core/class/dolreceiptprinter.class.php
Normal file
601
htdocs/core/class/dolreceiptprinter.class.php
Normal file
@ -0,0 +1,601 @@
|
||||
<?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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/dolreceiptprinter.class.php
|
||||
* \brief Print receipt ticket on various ESC/POS printer
|
||||
*/
|
||||
|
||||
/*
|
||||
* Tags for ticket template
|
||||
*
|
||||
* <dol_align_left> Left align text
|
||||
* <dol_align_center> Center text
|
||||
* <dol_align_right> Right align text
|
||||
* <dol_use_font_a> Use font A of printer
|
||||
* <dol_use_font_b> Use font B of printer
|
||||
* <dol_use_font_c> Use font C of printer
|
||||
* <dol_bold> </dol_bold> Text Bold
|
||||
* <dol_double_height> </dol_double_height> Text double height
|
||||
* <dol_double_width> </dol_double_width> Text double width
|
||||
* <dol_underline> </dol_underline> Underline text
|
||||
* <dol_underline_2dots> </dol_underline_2dots> Underline with double line
|
||||
* <dol_emphasized> </dol_emphasized> Emphasized text
|
||||
* <dol_switch_colors> </dol_switch_colors> Print in white on black
|
||||
* <dol_print_barcode> Print barcode
|
||||
* <dol_print_barcode_customer_id> Print barcode customer id
|
||||
* <dol_set_print_width_57> Ticket print width of 57mm
|
||||
* <dol_cut_paper_full> Cut ticket completely
|
||||
* <dol_cut_paper_partial> Cut ticket partially
|
||||
* <dol_open_drawer> Open cash drawer
|
||||
* <dol_activate_buzzer> Activate buzzer
|
||||
*
|
||||
* Code which can be placed everywhere
|
||||
* <dol_print_qrcode> Print QR Code
|
||||
* <dol_print_date> Print date AAAA-MM-DD
|
||||
* <dol_print_date_time> Print date and time AAAA-MM-DD HH:MM:SS
|
||||
* <dol_print_year> Print Year
|
||||
* <dol_print_month_letters> Print month in letters (example : november)
|
||||
* <dol_print_month> Print month number
|
||||
* <dol_print_day> Print day number
|
||||
* <dol_print_day_letters> Print day number
|
||||
* <dol_print_table> Print table number (for restaurant, bar...)
|
||||
* <dol_print_cutlery> Print number of cutlery (for restaurant)
|
||||
* <dol_print_payment> Print payment method
|
||||
* <dol_print_logo> Print logo stored on printer. Example : <print_logo>32|32
|
||||
* <dol_print_logo_old> Print logo stored on printer. Must be followed by logo code. For old printers.
|
||||
* <dol_print_order_lines> Print order lines
|
||||
* <dol_print_order_tax> Print order total tax
|
||||
* <dol_print_order_local_tax> Print order local tax
|
||||
* <dol_print_order_total> Print order total
|
||||
* <dol_print_order_number> Print order number
|
||||
* <dol_print_order_number_unique> Print order number after validation
|
||||
* <dol_print_customer_firstname> Print customer firstname
|
||||
* <dol_print_customer_lastname> Print customer name
|
||||
* <dol_print_customer_mail> Print customer mail
|
||||
* <dol_print_customer_phone> Print customer phone
|
||||
* <dol_print_customer_mobile> Print customer mobile
|
||||
* <dol_print_customer_skype> Print customer skype
|
||||
* <dol_print_customer_tax_number> Print customer VAT number
|
||||
* <dol_print_customer_account_balance> Print customer account balance
|
||||
* <dol_print_vendor_last_name> Print vendor name
|
||||
* <dol_print_vendor_first_name> Print vendor firstname
|
||||
* <dol_print_vendor_mail> Print vendor mail
|
||||
* <dol_print_customer_points> Print customer points
|
||||
* <dol_print_order_points> Print number of points for this order
|
||||
*
|
||||
* Conditional code at line start (if…then Print)
|
||||
* <dol_print_if_customer> Print the line IF a customer is affected to the order
|
||||
* <dol_print_if_vendor> Print the line IF a vendor is affected to the order
|
||||
* <dol_print_if_happy_hour> Print the line IF Happy Hour
|
||||
* <dol_print_if_num_order_unique> Print the line IF order is validated
|
||||
* <dol_print_if_customer_points> Print the line IF customer points > 0
|
||||
* <dol_print_if_order_points> Print the line IF points of the order > 0
|
||||
* <dol_print_if_customer_tax_number> Print the line IF customer has vat number
|
||||
* <dol_print_if_customer_account_balance_positive> Print the line IF customer balance > 0
|
||||
*
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/Escpos.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage Receipt Printers
|
||||
*/
|
||||
class dolReceiptPrinter extends Escpos
|
||||
{
|
||||
const CONNECTOR_DUMMY = 1;
|
||||
const CONNECTOR_FILE_PRINT = 2;
|
||||
const CONNECTOR_NETWORK_PRINT = 3;
|
||||
const CONNECTOR_WINDOWS_PRINT = 4;
|
||||
//const CONNECTOR_JAVA = 5;
|
||||
var $db;
|
||||
var $tags;
|
||||
var $printer;
|
||||
var $template;
|
||||
var $error;
|
||||
var $errors;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db database
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->tags = array(
|
||||
'dol_align_left',
|
||||
'dol_align_center',
|
||||
'dol_align_right',
|
||||
'dol_use_font_a',
|
||||
'dol_use_font_b',
|
||||
'dol_use_font_c',
|
||||
'dol_bold',
|
||||
'/dol_bold',
|
||||
'dol_double_height',
|
||||
'/dol_double_height',
|
||||
'dol_double_width',
|
||||
'/dol_double_width',
|
||||
'dol_underline',
|
||||
'/dol_underline',
|
||||
'dol_underline_2dots',
|
||||
'/dol_underline',
|
||||
'dol_emphasized',
|
||||
'/dol_emphasized',
|
||||
'dol_switch_colors',
|
||||
'/dol_switch_colors',
|
||||
'dol_print_barcode',
|
||||
'dol_print_barcode_customer_id',
|
||||
'dol_set_print_width_57',
|
||||
'dol_cut_paper_full',
|
||||
'dol_cut_paper_partial',
|
||||
'dol_open_drawer',
|
||||
'dol_activate_buzzer',
|
||||
'dol_print_qrcode',
|
||||
'dol_print_date',
|
||||
'dol_print_date_time',
|
||||
'dol_print_year',
|
||||
'dol_print_month_letters',
|
||||
'dol_print_month',
|
||||
'dol_print_day',
|
||||
'dol_print_day_letters',
|
||||
'dol_print_table',
|
||||
'dol_print_cutlery',
|
||||
'dol_print_payment',
|
||||
'dol_print_logo',
|
||||
'dol_print_logo_old',
|
||||
'dol_print_order_lines',
|
||||
'dol_print_order_tax',
|
||||
'dol_print_order_local_tax',
|
||||
'dol_print_order_total',
|
||||
'dol_print_order_number',
|
||||
'dol_print_order_number_unique',
|
||||
'dol_print_customer_firstname',
|
||||
'dol_print_customer_lastname',
|
||||
'dol_print_customer_mail',
|
||||
'dol_print_customer_phone',
|
||||
'dol_print_customer_mobile',
|
||||
'dol_print_customer_skype',
|
||||
'dol_print_customer_tax_number',
|
||||
'dol_print_customer_account_balance',
|
||||
'dol_print_vendor_lastname',
|
||||
'dol_print_vendor_firstname',
|
||||
'dol_print_vendor_mail',
|
||||
'dol_print_customer_points',
|
||||
'dol_print_order_points',
|
||||
'dol_print_if_customer',
|
||||
'dol_print_if_vendor',
|
||||
'dol_print_if_happy_hour',
|
||||
'dol_print_if_num_order_unique',
|
||||
'dol_print_if_customer_points',
|
||||
'dol_print_if_order_points',
|
||||
'dol_print_if_customer_tax_number',
|
||||
'dol_print_if_customer_account_balance_positive',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* list printers
|
||||
*
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function listPrinters()
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$line = 0;
|
||||
$sql = 'SELECT rowid, name, fk_type, parameter';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql.= ' WHERE entity = '.$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
while ($line < $num) {
|
||||
$obj[] = $this->db->fetch_array($resql);
|
||||
$line++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
$this->listprinters = $obj;
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List printers templates
|
||||
*
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function listPrintersTemplates()
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$line = 0;
|
||||
$sql = 'SELECT rowid, name, template';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql.= ' WHERE entity = '.$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
while ($line < $num) {
|
||||
$obj[] = $this->db->fetch_array($resql);
|
||||
$line++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
$this->listprinterstemplates = $obj;
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Form to Select type printer
|
||||
*
|
||||
* @param string $selected Id printer type pre-selected
|
||||
* @param string $htmlname select html name
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function selectTypePrinter($selected='', $htmlname='printertypeid')
|
||||
{
|
||||
global $langs;
|
||||
$error = 0;
|
||||
$html = '<select class="flat" name="'.$htmlname.'">';
|
||||
$html.= '<option value="1" '.($selected==1?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_DUMMY').'</option>';
|
||||
$html.= '<option value="2" '.($selected==2?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_FILE_PRINT').'</option>';
|
||||
$html.= '<option value="3" '.($selected==3?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_NETWORK_PRINT').'</option>';
|
||||
$html.= '<option value="4" '.($selected==4?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_WINDOWS_PRINT').'</option>';
|
||||
//$html.= '<option value="5" '.($selected==5?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_JAVA').'</option>';
|
||||
$html.= '</select>';
|
||||
|
||||
$this->resprint = $html;
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Add a printer in db
|
||||
*
|
||||
* @param string $name Printer name
|
||||
* @param int $type Printer type
|
||||
* @param string $parameter Printer parameter
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function AddPrinter($name, $type, $parameter)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql.= ' (name, fk_type, parameter, entity)';
|
||||
$sql.= ' VALUES ("'.$this->db->escape($name).'", '.$type.', "'.$this->db->escape($parameter).'", '.$conf->entity.')';
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Update a printer in db
|
||||
*
|
||||
* @param string $name Printer name
|
||||
* @param int $type Printer type
|
||||
* @param string $parameter Printer parameter
|
||||
* @param int $printerid Printer id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function UpdatePrinter($name, $type, $parameter, $printerid)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql.= ' SET name="'.$this->db->escape($name).'"';
|
||||
$sql.= ', fk_type='.$type;
|
||||
$sql.= ', parameter="'.$this->db->escape($parameter).'"';
|
||||
$sql.= ' WHERE rowid='.$printerid;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Delete a printer from db
|
||||
*
|
||||
* @param int $printerid Printer id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function DeletePrinter($printerid)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql.= ' WHERE rowid='.$printerid;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Update a printer template in db
|
||||
*
|
||||
* @param string $name Template name
|
||||
* @param int $template Template
|
||||
* @param int $templateid Template id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function UpdateTemplate($name, $template, $templateid)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql.= ' SET name="'.$this->db->escape($name).'"';
|
||||
$sql.= ', template="'.$this->db->escape($template).'"';
|
||||
$sql.= ' WHERE rowid='.$templateid;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to Send Test page to Printer
|
||||
*
|
||||
* @param int $printerid Printer id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function SendTestToPrinter($printerid)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$img = new EscposImage(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png');
|
||||
$ret = $this->InitPrinter($printerid);
|
||||
if ($ret>0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
} else {
|
||||
try {
|
||||
$this->printer->graphics($img);
|
||||
$this->printer->text("Hello World!\n");
|
||||
$testStr = "Testing 123";
|
||||
$this->printer->qrCode($testStr);
|
||||
$this->printer->text("Most simple example\n");
|
||||
$this->printer->feed();
|
||||
$this->printer->cut();
|
||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||
$this->printer->close();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to Print Receipt Ticket
|
||||
*
|
||||
* @param object $object order or invoice object
|
||||
* @param int $templateid Template id
|
||||
* @param int $printerid Printer id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function SendToPrinter($object, $templateid, $printerid)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$ret = $this->loadTemplate($templateid);
|
||||
|
||||
// tags a remplacer par leur valeur avant de parser
|
||||
$this->template = str_replace('<dol_print_num_order>', $object->id, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_firstname>', $object->customer_firstname, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_lastname>', $object->customer_lastname, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_mail>', $object->customer_mail, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_phone>', $object->customer_phone, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_mobile>', $object->customer_mobile, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_skype>', $object->customer_skype, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_tax_number>', $object->customer_tax_number, $this->template);
|
||||
$this->template = str_replace('<dol_print_customer_account_balance>', $object->customer_account_balance, $this->template);
|
||||
$this->template = str_replace('<dol_print_vendor_firstname>', $object->vendor_firstname, $this->template);
|
||||
$this->template = str_replace('<dol_print_vendor_lastname>', $object->vendor_lastname, $this->template);
|
||||
$this->template = str_replace('<dol_print_date_time>', $object->date_time, $this->template);
|
||||
|
||||
// parse template
|
||||
$p = xml_parser_create();
|
||||
xml_parse_into_struct($p, $this->template, $vals, $index);
|
||||
xml_parser_free($p);
|
||||
//print '<pre>'.print_r($index, true).'</pre>';
|
||||
//print '<pre>'.print_r($vals, true).'</pre>';
|
||||
// print ticket
|
||||
$level = 0;
|
||||
$html = '<table border="1" style="width:210px"><pre>';
|
||||
$ret = $this->InitPrinter($printerid);
|
||||
if ($ret>0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
} else {
|
||||
for ($line=0; $line < count($vals); $line++) {
|
||||
switch ($vals[$line]['tag']) {
|
||||
case 'DOL_ALIGN_CENTER':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
|
||||
$html.='<center>';
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_ALIGN_RIGHT':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_RIGHT);
|
||||
$html.='<right>';
|
||||
break;
|
||||
case 'DOL_ALIGN_LEFT':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_LEFT);
|
||||
$html.='<left>';
|
||||
break;
|
||||
case 'DOL_OPEN_DRAWER':
|
||||
$this->printer->pulse();
|
||||
$html.= ' ϟ'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_PRINT_BARCODE':
|
||||
// $vals[$line]['value'] -> barcode($content, $type)
|
||||
$this->printer->barcode($object->barcode);
|
||||
break;
|
||||
case 'DOL_PRINT_QRCODE':
|
||||
// $vals[$line]['value'] -> qrCode($content, $ec, $size, $model)
|
||||
$this->printer->qrcode($vals[$line]['value']);
|
||||
$html.='QRCODE: '.$vals[$line]['value'];
|
||||
break;
|
||||
case 'DOL_CUT_PAPER_FULL':
|
||||
$this->printer->cut(Escpos::CUT_FULL);
|
||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_CUT_PAPER_PARTIAL':
|
||||
$this->printer->cut(Escpos::CUT_PARTIAL);
|
||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_USE_FONT_A':
|
||||
$this->printer->setFont(Escpos::FONT_A);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_USE_FONT_B':
|
||||
$this->printer->setFont(Escpos::FONT_B);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_USE_FONT_C':
|
||||
$this->printer->setFont(Escpos::FONT_C);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
break;
|
||||
default:
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$html.= nl2br($vals[$line]['value']);
|
||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>';
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$html.= '</pre></table>';
|
||||
print $html;
|
||||
// Close and print
|
||||
// uncomment next line to see content sent to printer
|
||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||
$this->printer->close();
|
||||
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to load Template
|
||||
*
|
||||
* @param int $templateid Template id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function loadTemplate($templateid)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$sql = 'SELECT template';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt_template';
|
||||
$sql.= ' WHERE rowid='.$templateid;
|
||||
$sql.= ' AND entity = '.$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_array($resql);
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
if (empty($obj)) {
|
||||
$error++;
|
||||
$this->errors[] = 'TemplateDontExist';
|
||||
} else {
|
||||
$this->template = $obj['0'];
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Init Printer
|
||||
*
|
||||
* @param int $printerid Printer id
|
||||
* @return int 0 if OK; >0 if KO
|
||||
*/
|
||||
function InitPrinter($printerid)
|
||||
{
|
||||
global $conf;
|
||||
$error=0;
|
||||
$sql = 'SELECT rowid, name, fk_type, parameter';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'printer_receipt';
|
||||
$sql.= ' WHERE rowid = '.$printerid;
|
||||
$sql.= ' AND entity = '.$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_array($resql);
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
}
|
||||
if (empty($obj)) {
|
||||
$error++;
|
||||
$this->errors[] = 'PrinterDontExist';
|
||||
}
|
||||
if (! $error) {
|
||||
$parameter = $obj['parameter'];
|
||||
try {
|
||||
switch ($obj['fk_type']) {
|
||||
case 1:
|
||||
require_once DOL_DOCUMENT_ROOT .'/includes/escpos/src/DummyPrintConnector.php';
|
||||
$this->connector = new DummyPrintConnector();
|
||||
break;
|
||||
case 2:
|
||||
$this->connector = new FilePrintConnector($parameter);
|
||||
break;
|
||||
case 3:
|
||||
$parameters = explode(':', $parameter);
|
||||
$this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
|
||||
break;
|
||||
case 4:
|
||||
$this->connector = new WindowsPrintConnector($parameter);
|
||||
break;
|
||||
default:
|
||||
$this->connector = 'CONNECTOR_UNKNOWN';
|
||||
break;
|
||||
}
|
||||
$this->printer = new Escpos($this->connector);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
@ -258,7 +258,7 @@ class ExtraFields
|
||||
|
||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
|
||||
{
|
||||
if(is_array($param) and count($param) > 0)
|
||||
if(is_array($param) && count($param) > 0)
|
||||
{
|
||||
$params = $this->db->escape(serialize($param));
|
||||
}
|
||||
@ -739,10 +739,10 @@ class ExtraFields
|
||||
elseif ($type == 'select')
|
||||
{
|
||||
$out = '';
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo)
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
@ -760,10 +760,10 @@ class ExtraFields
|
||||
elseif ($type == 'sellist')
|
||||
{
|
||||
$out = '';
|
||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
||||
@ -1111,7 +1111,7 @@ class ExtraFields
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show
|
||||
* @param string $moreparam More param
|
||||
* @param string $moreparam To add more parametes on html input tag (only checkbox use html input for output rendering)
|
||||
* @return string Formated value
|
||||
*/
|
||||
function showOutputField($key,$value,$moreparam='')
|
||||
@ -1128,6 +1128,8 @@ class ExtraFields
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
|
||||
$showsize=0;
|
||||
|
||||
if ($type == 'date')
|
||||
{
|
||||
$showsize=10;
|
||||
@ -1357,11 +1359,59 @@ class ExtraFields
|
||||
$showsize=round($size);
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
|
||||
//print $type.'-'.$size;
|
||||
$out=$value;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return tag to describe alignement to use for this extrafield
|
||||
*
|
||||
* @param string $key Key of attribute
|
||||
* @return string Formated value
|
||||
*/
|
||||
function getAlignFlag($key)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$type=$this->attribute_type[$key];
|
||||
|
||||
$align='';
|
||||
|
||||
if ($type == 'date')
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
elseif ($type == 'int')
|
||||
{
|
||||
$align="right";
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
{
|
||||
$align="right";
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
elseif ($type == 'radio')
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
elseif ($type == 'checkbox')
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
|
||||
return $align;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML string to print separator extrafield
|
||||
*
|
||||
|
||||
@ -118,7 +118,7 @@ class HookManager
|
||||
* @param Object $object Object to use hooks on
|
||||
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
||||
* @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results and set into ->resArray.
|
||||
* All types can also return some values into an array ->results.
|
||||
* $this->error or this->errors are also defined by class called by this function if error.
|
||||
*/
|
||||
@ -163,11 +163,13 @@ class HookManager
|
||||
'printAddress',
|
||||
'printSearchForm',
|
||||
'formatEvent',
|
||||
'addCalendarChoice'
|
||||
'addCalendarChoice',
|
||||
'printObjectLine',
|
||||
'printObjectSubLine'
|
||||
)
|
||||
)) $hooktype='addreplace';
|
||||
// Deprecated hook types ('returnvalue')
|
||||
if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks.
|
||||
//if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks.
|
||||
if ($method == 'insertExtraFields')
|
||||
{
|
||||
$hooktype='returnvalue'; // deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
|
||||
|
||||
@ -1546,7 +1546,7 @@ class Form
|
||||
print img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
}
|
||||
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' autofocus />';
|
||||
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||
if ($hidelabel == 3) {
|
||||
print img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
@ -1663,7 +1663,7 @@ class Form
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'" autofocus>';
|
||||
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out.='<option value="0" selected> </option>';
|
||||
|
||||
$i = 0;
|
||||
@ -4057,10 +4057,11 @@ class Form
|
||||
* @param int $disabled Disable input fields
|
||||
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
|
||||
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
|
||||
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
|
||||
* @return mixed Nothing or string if nooutput is 1
|
||||
* @see form_date
|
||||
*/
|
||||
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='')
|
||||
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -4318,6 +4319,13 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
// Add a "Plus one hour" link
|
||||
if ($conf->use_javascript_ajax && $adddateof)
|
||||
{
|
||||
$tmparray=dol_getdate($adddateof);
|
||||
$retstring.=' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof,'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$langs->trans("DateInvoice").'</a>';
|
||||
}
|
||||
|
||||
if (! empty($nooutput)) return $retstring;
|
||||
|
||||
print $retstring;
|
||||
@ -4513,22 +4521,26 @@ class Form
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
|
||||
* @param string $placeholder String to use as placeholder
|
||||
* @return string HTML select string.
|
||||
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
|
||||
* @return string HTML select string
|
||||
*/
|
||||
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='')
|
||||
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
|
||||
{
|
||||
global $langs;
|
||||
global $delayedhtmlcontent;
|
||||
|
||||
$out = '';
|
||||
|
||||
$tmpplugin='select2';
|
||||
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
|
||||
$out='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
|
||||
|
||||
// TODO Use an internal dolibarr component instead of select2
|
||||
$outdelayed='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
|
||||
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
|
||||
|
||||
$(".'.$htmlname.'").select2({
|
||||
$(".'.$htmlname.'").select2({
|
||||
ajax: {
|
||||
dir: "ltr",
|
||||
url: "'.$url.'",
|
||||
@ -4562,6 +4574,7 @@ class Form
|
||||
},*/
|
||||
cache: true
|
||||
},
|
||||
dropdownCssClass: "css-'.$htmlname.'",
|
||||
placeholder: "'.dol_escape_js($placeholder).'",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: '.$minimumInputLength.',
|
||||
@ -4583,12 +4596,17 @@ class Form
|
||||
});
|
||||
});' : '' ) . '
|
||||
|
||||
});
|
||||
</script>';
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
$out.='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
|
||||
|
||||
if ($acceptdelayedhtml)
|
||||
{
|
||||
$delayedhtmlcontent.=$outdelayed;
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.=$outdelayed;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -5156,7 +5174,7 @@ class Form
|
||||
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
|
||||
*
|
||||
* @param object $object Object to show
|
||||
* @param string $paramid Name of parameter to use to name the id into the URL link
|
||||
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
|
||||
* @param string $morehtml More html content to output just before the nav bar
|
||||
* @param int $shownav Show Condition (navigation is shown if value is 1)
|
||||
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
|
||||
@ -5191,7 +5209,7 @@ class Form
|
||||
|
||||
$ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">';
|
||||
|
||||
// For thirdparty and contact, the ref is he id, so we show something else
|
||||
// For thirdparty and contact, the ref is the id, so we show something else
|
||||
if ($object->element == 'societe')
|
||||
{
|
||||
$ret.=dol_htmlentities($object->name);
|
||||
@ -5359,7 +5377,7 @@ class Form
|
||||
else
|
||||
{
|
||||
$nophoto='/public/theme/common/nophoto.png';
|
||||
if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users
|
||||
if (in_array($modulepart,array('userphoto','contact'))) // For module that are "physical" users
|
||||
{
|
||||
$nophoto='/public/theme/common/user_anonymous.png';
|
||||
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';
|
||||
|
||||
@ -285,7 +285,7 @@ class FormFile
|
||||
}
|
||||
|
||||
$printer=0;
|
||||
if (in_array($modulepart,array('facture','askpricesupplier','propal','proposal','order','commande','expedition'))) // The direct print feature is implemented only for such elements
|
||||
if (in_array($modulepart,array('facture','askpricesupplier','propal','proposal','order','commande','expedition', 'commande_fournisseur'))) // The direct print feature is implemented only for such elements
|
||||
{
|
||||
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled))?true:false;
|
||||
}
|
||||
@ -822,7 +822,12 @@ class FormFile
|
||||
if ($object->element == 'member') $relativepath=get_exdir($object->id,2,0,0,$object,'member').$relativepath; // TODO Call using a defined value for $relativepath
|
||||
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
||||
}
|
||||
|
||||
// For backward compatiblity, we detect file is stored into an old path
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $file['level1name'] == 'photos')
|
||||
{
|
||||
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
@ -108,7 +108,7 @@ class Ldap
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//Server
|
||||
// Server
|
||||
if (! empty($conf->global->LDAP_SERVER_HOST)) $this->server[] = $conf->global->LDAP_SERVER_HOST;
|
||||
if (! empty($conf->global->LDAP_SERVER_HOST_SLAVE)) $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
|
||||
$this->serverPort = $conf->global->LDAP_SERVER_PORT;
|
||||
@ -120,9 +120,11 @@ class Ldap
|
||||
$this->searchPassword = $conf->global->LDAP_ADMIN_PASS;
|
||||
$this->people = $conf->global->LDAP_USER_DN;
|
||||
$this->groups = $conf->global->LDAP_GROUP_DN;
|
||||
$this->filter = $conf->global->LDAP_FILTER_CONNECTION;
|
||||
|
||||
//Users
|
||||
$this->filter = $conf->global->LDAP_FILTER_CONNECTION; // Filter on user
|
||||
$this->filtermember = $conf->global->LDAP_MEMBER_FILTER; // Filter on member
|
||||
|
||||
// Users
|
||||
$this->attr_login = $conf->global->LDAP_FIELD_LOGIN; //unix
|
||||
$this->attr_sambalogin = $conf->global->LDAP_FIELD_LOGIN_SAMBA; //samba, activedirectory
|
||||
$this->attr_name = $conf->global->LDAP_FIELD_NAME;
|
||||
@ -891,14 +893,14 @@ class Ldap
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing a details of elements
|
||||
* Returns an array containing a details or list of LDAP record(s)
|
||||
* ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
|
||||
*
|
||||
* @param string $search Valeur champ cle recherche, sinon '*' pour tous.
|
||||
* @param string $search Value of fiel to search, '*' for all. Not used if $activefilter is set.
|
||||
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
|
||||
* @param string $useridentifier Name of key field (Ex: uid)
|
||||
* @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword)
|
||||
* @param int $activefilter 1=use field this->filter as filter instead of parameter $search
|
||||
* @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'member'=use field this->filtermember as filter
|
||||
* @param array $attributeAsArray Array of fields wanted as an array not a string
|
||||
* @return array Array of [id_record][ldap_field]=value
|
||||
*/
|
||||
@ -906,7 +908,7 @@ class Ldap
|
||||
{
|
||||
$fulllist=array();
|
||||
|
||||
dol_syslog(get_class($this)."::getRecords search=".$search." userDn=".$userDn." useridentifier=".$useridentifier." attributeArray=array(".join(',',$attributeArray).")");
|
||||
dol_syslog(get_class($this)."::getRecords search=".$search." userDn=".$userDn." useridentifier=".$useridentifier." attributeArray=array(".join(',',$attributeArray).") activefilter=".$activefilter);
|
||||
|
||||
// if the directory is AD, then bind first with the search user first
|
||||
if ($this->serverType == "activedirectory")
|
||||
@ -916,15 +918,19 @@ class Ldap
|
||||
}
|
||||
|
||||
// Define filter
|
||||
if ($activefilter == 1)
|
||||
if (! empty($activefilter))
|
||||
{
|
||||
if ($this->filter)
|
||||
if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter)
|
||||
{
|
||||
$filter = '('.$this->filter.')';
|
||||
}
|
||||
else
|
||||
elseif (((string) $activefilter == 'member') && $this->filter)
|
||||
{
|
||||
$filter='('.$useridentifier.'=*)';
|
||||
$filter = '('.$this->filtermember.')';
|
||||
}
|
||||
else // If this->filter is empty, make fiter on * (all)
|
||||
{
|
||||
$filter = '('.$useridentifier.'=*)';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
64
htdocs/core/js/select2_locale.js.php
Normal file
64
htdocs/core/js/select2_locale.js.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/core/js/timepicker.js.php
|
||||
* \brief File that include javascript functions for timepicker
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
session_cache_limiter(FALSE);
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
|
||||
// Define javascript type
|
||||
header('Content-type: text/javascript; charset=UTF-8');
|
||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||
else header('Cache-Control: no-cache');
|
||||
?>
|
||||
|
||||
/**
|
||||
* Select2 French translation
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn.select2.locales['xx'] = {
|
||||
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
|
||||
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
|
||||
formatInputTooShort: function (input, min) { var n = min - input.length; return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>"; },
|
||||
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
|
||||
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
|
||||
};
|
||||
|
||||
$.extend($.fn.select2.defaults, $.fn.select2.locales['xx']);
|
||||
})(jQuery);
|
||||
|
||||
<?php
|
||||
if (is_object($db)) $db->close();
|
||||
@ -800,13 +800,14 @@ function unActivateModule($value, $requiredby=1)
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module is bugged
|
||||
//print $dir.$modFile;
|
||||
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded
|
||||
$genericMod = new DolibarrModules($db);
|
||||
$genericMod->name=preg_replace('/^mod/i','',$modName);
|
||||
$genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName));
|
||||
$genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName));
|
||||
dol_syslog("modules::unActivateModule Failed to find module file, we use generic function with name " . $modName);
|
||||
$genericMod->_remove('');
|
||||
$genericMod->_remove(array());
|
||||
}
|
||||
|
||||
// Desactivation des modules qui dependent de lui
|
||||
|
||||
@ -52,16 +52,13 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
// Remove product id before select another product
|
||||
// use keyup instead change to avoid loosing the product id
|
||||
$("input#search_'.$htmlname.'").keydown(function() {
|
||||
//console.log(\'purge_id_after_keydown\');
|
||||
$("#'.$htmlname.'").val("");
|
||||
});
|
||||
$("input#search_'.$htmlname.'").change(function() {
|
||||
//console.log(\'change\');
|
||||
$("#'.$htmlname.'").trigger("change");
|
||||
});
|
||||
// Check when keyup
|
||||
$("input#search_'.$htmlname.'").keyup(function() {
|
||||
//console.log(\'keyup\');
|
||||
if ($(this).val().length == 0)
|
||||
{
|
||||
$("#search_'.$htmlname.'").val("");
|
||||
@ -127,7 +124,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
dataType: "json",
|
||||
minLength: '.$minLength.',
|
||||
select: function( event, ui ) { // Function ran when new value is selected into javascript combo
|
||||
//console.log(\'set value of id with \'+ui.item.id);
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
// Disable an element
|
||||
if (options.option_disabled) {
|
||||
@ -171,7 +167,6 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
|
||||
}
|
||||
,delay: 500
|
||||
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
|
||||
|
||||
@ -106,7 +106,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
|
||||
$ref_prodserv = "";
|
||||
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
||||
{
|
||||
if ($prodser->isservice())
|
||||
if ($prodser->isService())
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||
}
|
||||
|
||||
@ -179,6 +179,7 @@ function getBrowserInfo($user_agent)
|
||||
|
||||
// OS
|
||||
if (preg_match('/linux/i', $user_agent)) { $os='linux'; }
|
||||
elseif (preg_match('/macintosh/i', $user_agent)) { $os='macintosh'; }
|
||||
|
||||
// Name
|
||||
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; }
|
||||
@ -703,7 +704,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
|
||||
function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0)
|
||||
{
|
||||
global $conf,$langs, $hookmanager;
|
||||
|
||||
|
||||
$out="\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
|
||||
|
||||
// Show title
|
||||
@ -733,7 +734,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
|
||||
$displaytab=0;
|
||||
$nbintab=0;
|
||||
$popuptab=0;
|
||||
|
||||
|
||||
for ($i = 0 ; $i <= $maxkey ; $i++)
|
||||
{
|
||||
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2]))
|
||||
@ -777,7 +778,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
|
||||
else
|
||||
{
|
||||
// The popup with the other tabs
|
||||
if (! $popuptab)
|
||||
if (! $popuptab)
|
||||
{
|
||||
$popuptab=1;
|
||||
$outmore.='<div class="popuptabset">';
|
||||
@ -795,13 +796,13 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
|
||||
$outmore.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
|
||||
|
||||
$outmore.='</div>';
|
||||
|
||||
|
||||
$nbintab++;
|
||||
}
|
||||
$displaytab=$i;
|
||||
}
|
||||
if ($popuptab) $outmore.='</div>';
|
||||
|
||||
|
||||
if ($displaytab > $limittoshow)
|
||||
{
|
||||
$tabsname=str_replace("@", "", $picto);
|
||||
@ -817,7 +818,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
|
||||
}
|
||||
|
||||
$out.="</div>\n";
|
||||
|
||||
|
||||
if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
|
||||
|
||||
$parameters=array('tabname' => $active);
|
||||
@ -853,7 +854,7 @@ function dol_get_fiche_end($notab=0)
|
||||
* Show tab footer of a card
|
||||
*
|
||||
* @param object $object Object to show
|
||||
* @param string $paramid Name of parameter to use to name the id into the URL link
|
||||
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
|
||||
* @param string $morehtml More html content to output just before the nav bar
|
||||
* @param int $shownav Show Condition (navigation is shown if value is 1)
|
||||
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
|
||||
@ -869,28 +870,67 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
{
|
||||
global $conf, $form, $user, $langs;
|
||||
|
||||
//$showlogo=$object->logo;
|
||||
$showlogo=1;
|
||||
$maxvisiblephotos=1;
|
||||
$showimage=1;
|
||||
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
|
||||
$modulepart='societe';
|
||||
$modulepart='unknown';
|
||||
if ($object->element == 'societe') $modulepart='societe';
|
||||
if ($object->element == 'contact') $modulepart='contact';
|
||||
if ($object->element == 'member') $modulepart='memberphoto';
|
||||
if ($object->element == 'user') $modulepart='userphoto';
|
||||
if ($object->element == 'product') $modulepart='product';
|
||||
|
||||
print '<div class="arearef heightref valignmiddle" width="100%">';
|
||||
if ($showlogo) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref').'</div>';
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
$width=80; $cssclass='photoref';
|
||||
$showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
|
||||
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->product->multidir_output[$object->entity],1,-$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
$nophoto='/public/theme/common/nophoto.png';
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref','',1,0,$maxvisiblephotos).'</div>';
|
||||
}
|
||||
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
|
||||
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
|
||||
} else {
|
||||
}
|
||||
elseif ($object->element == 'product')
|
||||
{
|
||||
//$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlright.=ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
|
||||
} else {
|
||||
$morehtmlright.=$object->getLibStatut(2,0);
|
||||
}
|
||||
$morehtmlright.=' ';
|
||||
//$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlright.=ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
|
||||
} else {
|
||||
$morehtmlright.=$object->getLibStatut(2,1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$morehtmlright.=$object->getLibStatut(2);
|
||||
}
|
||||
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
||||
$morehtmlref.='</div>';
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member')))
|
||||
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
|
||||
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>'; // For product
|
||||
if ($object->element != 'product')
|
||||
{
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
||||
$morehtmlref.='</div>';
|
||||
}
|
||||
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product')))
|
||||
{
|
||||
$morehtmlref.='<div style="clear: both;"></div><div class="refidno">';
|
||||
$morehtmlref.=$langs->trans("TechnicalID").': '.$object->id;
|
||||
@ -900,7 +940,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
print '</div>';
|
||||
print '<div class="underrefbanner clearboth"></div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a string with the label tag dedicated to the HTML edit field.
|
||||
*
|
||||
@ -1382,7 +1422,7 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0)
|
||||
function dol_print_url($url,$target='_blank',$max=32,$withpicto=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
if (empty($url)) return '';
|
||||
|
||||
$link='<a href="';
|
||||
@ -1675,7 +1715,7 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0)
|
||||
global $conf, $user, $langs, $hookmanager;
|
||||
|
||||
$out = '';
|
||||
|
||||
|
||||
if ($address)
|
||||
{
|
||||
if ($hookmanager) {
|
||||
@ -1683,7 +1723,7 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0)
|
||||
$reshook = $hookmanager->executeHooks('printAddress', $parameters, $address);
|
||||
$out.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
if (empty($reshook))
|
||||
{
|
||||
$out.=nl2br($address);
|
||||
$showgmap=$showomap=0;
|
||||
@ -2748,7 +2788,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
||||
$sortorder=strtoupper($sortorder);
|
||||
$out='';
|
||||
$sortimg='';
|
||||
|
||||
|
||||
$tag='th';
|
||||
if ($thead==2) $tag='div';
|
||||
|
||||
@ -2815,9 +2855,9 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
||||
|
||||
$sortimg.= '</span>';
|
||||
}
|
||||
|
||||
|
||||
$out.=$sortimg;
|
||||
|
||||
|
||||
$out.='</'.$tag.'>';
|
||||
|
||||
return $out;
|
||||
@ -2958,7 +2998,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
if ($cpt > 2) $pagelist.='<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...</span></li>';
|
||||
else if ($cpt == 2) $pagelist.='<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><a '.(empty($conf->dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page=1'.$options.'&sortfield='.$sortfield.'&sortorder='.$sortorder.'">2</a></li>';
|
||||
}
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if ($cpt==$page)
|
||||
@ -2972,7 +3012,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
$cpt++;
|
||||
}
|
||||
while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage);
|
||||
|
||||
|
||||
if ($cpt<$nbpages)
|
||||
{
|
||||
if ($cpt<$nbpages-2) $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...</span></li>';
|
||||
@ -3841,13 +3881,14 @@ function yn($yesno, $case=1, $color=0)
|
||||
|
||||
/**
|
||||
* Return a path to have a directory according to object.
|
||||
* Examples: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/"
|
||||
* Examples: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
||||
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
|
||||
* Old usage: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/"
|
||||
* Old usage: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/"
|
||||
*
|
||||
* @param string $num Id of object
|
||||
* @param int $level Level of subdirs to return (1, 2 or 3 levels)
|
||||
* @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0).
|
||||
* @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '')
|
||||
* @param string $num Id of object (deprecated, $object will be used in future)
|
||||
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
|
||||
* @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0). (deprecated, global option will be used in future)
|
||||
* @param int $withoutslash 0=With slash at end (except if '/', we return ''), 1=without slash at end
|
||||
* @param Object $object Object
|
||||
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')
|
||||
* @return string Dir to use ending. Example '' or '1/' or '1/2/'
|
||||
@ -3858,10 +3899,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||
|
||||
$path = '';
|
||||
|
||||
// TODO if object is null, load it from id and modulepart.
|
||||
|
||||
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
|
||||
if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing')))
|
||||
{
|
||||
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
|
||||
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
|
||||
@ -3875,7 +3913,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||
{
|
||||
// TODO
|
||||
// We will introduce here a common way of forging path for document storage
|
||||
// Here, $num=id, ref and modulepart are required.
|
||||
// Here, object->id, object->ref and object->modulepart are required.
|
||||
|
||||
}
|
||||
|
||||
@ -4402,7 +4440,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
|
||||
}
|
||||
else if ($nameorder == 2)
|
||||
{
|
||||
$ret.=$firstname;
|
||||
$ret.=$firstname;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5155,6 +5193,10 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
{
|
||||
global $db,$langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$value=preg_replace('/\*/','%',$value); // Replace * with %
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
||||
@ -5225,20 +5267,20 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
|
||||
/**
|
||||
* Return the filename of file to get the thumbs
|
||||
*
|
||||
* @param string $file Original filename
|
||||
*
|
||||
* @param string $file Original filename (full or relative path)
|
||||
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
|
||||
* @param string $extImgTarget Force image format for thumbs. Use '' to keep same extension than original image.
|
||||
* @return string New file name
|
||||
* @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image.
|
||||
* @return string New file name (full or relative path, including the thumbs/)
|
||||
*/
|
||||
function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
||||
{
|
||||
$dirName = dirname($file);
|
||||
if ($dirName == '.') $dirName='';
|
||||
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
|
||||
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // We remove extension, whatever is its case
|
||||
$fileName = basename($fileName);
|
||||
|
||||
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':'');
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'');
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i',$file)?'.gif':'');
|
||||
@ -5246,9 +5288,9 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
||||
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i',$file)?'.bmp':'');
|
||||
|
||||
if (! $extImgTarget) return $file;
|
||||
|
||||
|
||||
$subdir='';
|
||||
if ($extName) $subdir = 'thumbs/';
|
||||
|
||||
return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
|
||||
|
||||
return ($dirName?$dirName.'/':'').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
|
||||
curl_setopt($ch, CURLOPT_POST, 0); // GET
|
||||
}
|
||||
|
||||
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
|
||||
//if USE_PROXY constant set at begin of this method.
|
||||
if ($USE_PROXY)
|
||||
{
|
||||
dol_syslog("getURLContent set proxy to ".$PROXY_HOST. ":" . $PROXY_PORT." - ".$PROXY_USER. ":" . $PROXY_PASS);
|
||||
|
||||
@ -512,7 +512,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
||||
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
|
||||
$fileName = basename($fileName);
|
||||
$imgThumbName = $dirthumb.'/'.getImageFileNameForSize($file, $extName, $extImgTarget); // Chemin complet du fichier de la vignette
|
||||
//$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file
|
||||
$imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file
|
||||
|
||||
|
||||
// Check if permission are ok
|
||||
//$fp = fopen($imgThumbName, "w");
|
||||
|
||||
@ -515,7 +515,7 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
|
||||
global $conf;
|
||||
|
||||
// Add a background image on document
|
||||
if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image
|
||||
if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image
|
||||
{
|
||||
$pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image
|
||||
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height);
|
||||
@ -1166,7 +1166,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
$ref_prodserv = "";
|
||||
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
||||
{
|
||||
if ($prodser->isservice())
|
||||
if ($prodser->isService())
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||
}
|
||||
@ -1261,18 +1261,22 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinenum',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
return dol_htmlentitiesbr($object->lines[$i]->num);
|
||||
$result.=dol_htmlentitiesbr($object->lines[$i]->num);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1290,18 +1294,22 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineref',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
return dol_htmlentitiesbr($object->lines[$i]->product_ref);
|
||||
$result.=dol_htmlentitiesbr($object->lines[$i]->product_ref);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1318,18 +1326,22 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineref_supplier',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
return dol_htmlentitiesbr($object->lines[$i]->ref_supplier);
|
||||
$result.=dol_htmlentitiesbr($object->lines[$i]->ref_supplier);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1345,9 +1357,10 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
$result='';
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduce this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
@ -1355,13 +1368,13 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1380,6 +1393,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$sign=1;
|
||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
$result='';
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
@ -1390,13 +1404,13 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) print $hookmanager->resPrint;
|
||||
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice, 0, $outputlangs);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * $object->lines[$i]->subprice, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1412,6 +1426,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
$result='';
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
@ -1422,13 +1437,13 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineupwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) print $hookmanager->resPrint;
|
||||
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1444,6 +1459,7 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
$result='';
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
@ -1454,15 +1470,14 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
else return $reshook;
|
||||
if(!empty($hookmanager->resPrint)) $result=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty;
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->qty;
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1479,6 +1494,7 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
@ -1488,14 +1504,14 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_asked;
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->qty_asked;
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1512,6 +1528,7 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
@ -1521,14 +1538,14 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty_shipped;
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->qty_shipped;
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1545,7 +1562,8 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
@ -1554,14 +1572,14 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return ($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1579,7 +1597,8 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
|
||||
global $langs;
|
||||
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
@ -1595,14 +1614,14 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=$langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1622,6 +1641,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
@ -1631,14 +1651,14 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1654,7 +1674,8 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
{
|
||||
$reshook=0;
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
@ -1668,9 +1689,9 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3) return '';
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->situation_percent . '%';
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->situation_percent . '%';
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1690,6 +1711,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
@ -1699,7 +1721,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -1707,9 +1729,9 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1735,7 +1757,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -1743,9 +1765,9 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1776,7 +1798,10 @@ function pdf_getTotalQty($object,$type,$outputlangs)
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
// TODO add hook function
|
||||
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_getTotalQty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
else if ($type==0 && $object->lines[$i]->product_type == 0)
|
||||
{
|
||||
@ -1812,7 +1837,7 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
if ($objecttype == 'propal')
|
||||
{
|
||||
$outputlangs->load('propal');
|
||||
|
||||
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user