Merge remote-tracking branch 'Upstream/develop' into develop-loan

This commit is contained in:
aspangaro 2015-03-22 18:08:12 +01:00
commit 414d4c6432
1581 changed files with 51104 additions and 5588 deletions

View File

@ -104,16 +104,15 @@ before_script:
script: script:
- cd htdocs/install - cd htdocs/install
- date - date
# - php upgrade.php 3.4.0 3.5.0 > upgrade.log # - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
# - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log # - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log - php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
# - cat upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
- php upgrade.php 3.7.0 3.8.0 >> upgrade.log - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
- php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log # - cat upgrade370380-2.log
# - cat upgrade2.log
- cd ../.. - cd ../..
- date - date
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php

View File

@ -1,6 +1,6 @@
[main] [main]
host = https://www.transifex.com host = https://www.transifex.com
lang_map = uz: uz_UZ lang_map = uz: uz_UZ, sw: sw_SW
[dolibarr.accountancy] [dolibarr.accountancy]
file_filter = htdocs/langs/<lang>/accountancy.lang file_filter = htdocs/langs/<lang>/accountancy.lang
@ -146,6 +146,12 @@ source_file = htdocs/langs/en_US/holiday.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.incoterm]
file_filter = htdocs/langs/<lang>/incoterm.lang
source_file = htdocs/langs/en_US/incoterm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.install] [dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang source_file = htdocs/langs/en_US/install.lang

View File

@ -31,7 +31,8 @@ WARNING: Following changes may create regression for some external modules, but
Dolibarr better: Dolibarr better:
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the - Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
trigger ORDER_SUPPLIER_CREATE instead. trigger ORDER_SUPPLIER_CREATE instead.
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
***** ChangeLog for 3.7 compared to 3.6.* ***** ***** ChangeLog for 3.7 compared to 3.6.* *****
@ -162,6 +163,7 @@ For translators:
- New: When a translation is not available we always jump to en_US and only en_US. - New: When a translation is not available we always jump to en_US and only en_US.
For developers: For developers:
- New: Syslog module can be set to use ChromePHP plugin to output log server into browser console.
- New: Add a css style "cursorpointer". - New: Add a css style "cursorpointer".
- New: Select list of users can return user into hierarchy. - New: Select list of users can return user into hierarchy.
- New: getBrowserInfo can return type of layout of browser (classic/phone/tablet) - New: getBrowserInfo can return type of layout of browser (classic/phone/tablet)
@ -233,6 +235,7 @@ Dolibarr better:
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key - Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
- Fix: Bad SEPA xml file creation - Fix: Bad SEPA xml file creation
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
- Fix: Showing system error if not enough stock of product into orders creation with lines
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.

68
dev/fixaltlanguages.sh Executable file
View File

@ -0,0 +1,68 @@
#!/bin/sh
# Recursively deduplicate file lines on a per file basis
# Useful to deduplicate language files
#
# Needs awk 4.0 for the inplace fixing command
#
# Raphaël Doursenaud - rdoursenaud@gpcsolutions.fr
# Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then
echo "Scan alternate language files and remove entries found into parent file"
echo "Usage: fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]"
exit
fi
if [ "x$2" = "x" ]
then
echo "Scan alternate language files and remove entries found into parent file"
echo "Usage: fixaltlanguages.sh (list|fix) (all|file.lang) [xx_XX]"
exit
fi
# To detect
if [ "x$1" = "xlist" ]
then
echo Feature not available
fi
# To fix
if [ "x$1" = "xfix" ]
then
for dir in `find htdocs/langs/$3* -type d`
do
dirshort=`basename $dir`
#echo $dirshort
export aa=`echo $dirshort | nawk -F"_" '{ print $1 }'`
export bb=`echo $dirshort | nawk -F"_" '{ print $2 }'`
aaupper=`echo $dirshort | nawk -F"_" '{ print toupper($1) }'`
if [ $aaupper = "EN" ]
then
aaupper="US"
fi
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
then
reflang="htdocs/langs/"$aa"_"$aaupper
if [ -d $reflang ]
then
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
echo $dirshort est une langue alternative de $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
do f=`cat $fic | wc -l`;
#echo $f lines into file $fic;
if [ $f = 1 ]
then
echo Only one line remainging into file $fic, we delete it;
rm $fic
fi;
done
fi
fi
done;
fi

View File

@ -10,7 +10,7 @@
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "This script clean files with CR+LF into files with LF only. All source files are included, also files into includes." echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, also files into includes."
echo "Usage: fixdosfiles.sh [list|fix]" echo "Usage: fixdosfiles.sh [list|fix]"
fi fi

View File

@ -7,6 +7,7 @@
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "Detect duplicate translation keys inside a file (there is no cross file check)."
echo "Usage: detectduplicatelangkey.sh (list|fix)" echo "Usage: detectduplicatelangkey.sh (list|fix)"
fi fi

View File

@ -9,17 +9,19 @@
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "Find exact duplicated lines into file (not cross file checking)"
echo "Usage: deduplicatefilelinesrecursively.sh [list|fix]" echo "Usage: deduplicatefilelinesrecursively.sh [list|fix]"
fi fi
# To detect # To detect
if [ "x$1" = "xlist" ] if [ "x$1" = "xlist" ]
then then
for file in `find . -type f -name *.lang` for file in `find htdocs/langs/en_US -type f -name *.lang`
do do
if [ `sort "$file" | uniq -d | wc -l` -gt 0 ] if [ `sort "$file" | grep -v '^$' | uniq -d | wc -l` -gt 0 ]
then then
echo "$file" echo "***** $file"
sort "$file" | grep -v '^$' | uniq -d
fi fi
done done
fi fi
@ -27,7 +29,7 @@ fi
# To fix # To fix
if [ "x$1" = "xfix" ] if [ "x$1" = "xfix" ]
then then
for file in `find . -type f -name *.lang` for file in `find htdocs/langs/en_US -type f -name *.lang`
do do
awk -i inplace ' !x[$0]++' "$file" awk -i inplace ' !x[$0]++' "$file"
done; done;

View File

@ -10,6 +10,7 @@
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "Fix permissions of files"
echo "Usage: fixperms.sh (list|fix)" echo "Usage: fixperms.sh (list|fix)"
fi fi

View File

@ -12,6 +12,7 @@
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "Detect and fix bad UTF8 encoded files (UTF8 must not use BOM char)"
echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]" echo "Usage: fixutf8bomfiles.sh (list|fix) [addincludes]"
fi fi

View File

@ -174,7 +174,7 @@ $targetcontent=$sourcecontent;
// Substitute class name // Substitute class name
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent); $targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent); $targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent); $targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$tablenoprefix.'\'', $targetcontent);
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent); $targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
// Substitute comments // Substitute comments
@ -252,7 +252,13 @@ foreach($property as $key => $prop)
if ($addfield) if ($addfield)
{ {
$varprop.="\t\t\$sql.= \" "; $varprop.="\t\t\$sql.= \" ";
if ($prop['istime']) if ($prop['field']=='datec')
{
$varprop.='"."\'".$this->db->idate(dol_now())."\'"."';
if ($i < count($property)) $varprop.=",";
$varprop.='";';
}
elseif ($prop['istime'])
{ {
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate('; $varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate(';
$varprop.="\$this->".$prop['field'].""; $varprop.="\$this->".$prop['field']."";
@ -268,6 +274,12 @@ foreach($property as $key => $prop)
if ($i < count($property)) $varprop.=","; if ($i < count($property)) $varprop.=",";
$varprop.='";'; $varprop.='";';
} }
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_author')
{
$varprop.='".$user->id."';
if ($i < count($property)) $varprop.=",";
$varprop.='";';
}
else else
{ {
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".'; $varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
@ -289,11 +301,17 @@ $i=0;
foreach($property as $key => $prop) foreach($property as $key => $prop)
{ {
$i++; $i++;
if ($prop['field'] != 'rowid' && $prop['field'] != 'id') if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && $prop['field'] != 'datec' && $prop['field'] != 'fk_user_author')
{ {
$varprop.="\t\t\$sql.= \" "; $varprop.="\t\t\$sql.= \" ";
$varprop.=$prop['field'].'='; $varprop.=$prop['field'].'=';
if ($prop['istime']) if ($prop['field']=='tms') {
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
$varprop.='$this->'.$prop['field'];
$varprop.=')."\'" : "\'".$this->db->idate(dol_now())."\'").';
$varprop.='"';
}
elseif ($prop['istime'])
{ {
// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null') // (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate('; $varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
@ -301,6 +319,9 @@ foreach($property as $key => $prop)
$varprop.=')."\'" : \'null\').'; $varprop.=')."\'" : \'null\').';
$varprop.='"'; $varprop.='"';
} }
elseif ($prop['field']=='fk_user_mod') {
$varprop.='".$user->id."';
}
else else
{ {
$varprop.="\"."; $varprop.="\".";
@ -325,6 +346,7 @@ $targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
// Substitute select set parameters // Substitute select set parameters
$varprop="\n"; $varprop="\n";
$varpropline="\n";
$cleanparam=''; $cleanparam='';
$i=0; $i=0;
foreach($property as $key => $prop) foreach($property as $key => $prop)
@ -338,11 +360,22 @@ foreach($property as $key => $prop)
if ($prop['istime']) $varprop.=')'; if ($prop['istime']) $varprop.=')';
$varprop.=";"; $varprop.=";";
$varprop.="\n"; $varprop.="\n";
$varpropline.="\t\t\t\t\$line->".$prop['field']." = ";
if ($prop['istime']) $varpropline.='$this->db->jdate(';
$varpropline.='$obj->'.$prop['field'];
if ($prop['istime']) $varpropline.=')';
$varpropline.=";";
$varpropline.="\n";
} }
} }
$targetcontent=preg_replace('/\$this->prop1 = \$obj->field1;/', $varprop, $targetcontent); $targetcontent=preg_replace('/\$this->prop1 = \$obj->field1;/', $varprop, $targetcontent);
$targetcontent=preg_replace('/\$this->prop2 = \$obj->field2;/', '', $targetcontent); $targetcontent=preg_replace('/\$this->prop2 = \$obj->field2;/', '', $targetcontent);
//Substirute fetchAll
$targetcontent=preg_replace('/\$line->prop1 = \$obj->field1;/', $varpropline, $targetcontent);
$targetcontent=preg_replace('/\$line->prop2 = \$obj->field2;/', '', $targetcontent);
// Substitute initasspecimen parameters // Substitute initasspecimen parameters
$varprop="\n"; $varprop="\n";

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) ---Put here your own copyright and developer email---
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -41,6 +42,8 @@ class Skeleton_Class extends CommonObject
var $element='skeleton'; //!< Id that identify managed objects var $element='skeleton'; //!< Id that identify managed objects
var $table_element='skeleton'; //!< Name of table without prefix where object is stored var $table_element='skeleton'; //!< Name of table without prefix where object is stored
var $lines=array();
var $id; var $id;
var $prop1; var $prop1;
var $prop2; var $prop2;
@ -103,11 +106,11 @@ class Skeleton_Class extends CommonObject
if (! $notrigger) if (! $notrigger)
{ {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action to call a trigger.
//// Call triggers //// Call triggers
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); //$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) $error++;
//// End call triggers //// End call triggers
} }
} }
@ -115,11 +118,6 @@ class Skeleton_Class extends CommonObject
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {
foreach($this->errors as $errmsg)
{
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1*$error;
} }
@ -175,6 +173,69 @@ class Skeleton_Class extends CommonObject
} }
} }
/**
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @return int <0 if KO, >0 if OK
*/
function fetchAll($sortorder, $sortfield, $limit, $offset, $filter = array())
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
//...
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
// Manage filter
$sqlwhere=array();
if (count($filter)>0) {
foreach ( $filter as $key => $value ) {
//$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
if (count($sqlwhere)>0) {
$sql.= ' WHERE '.implode(' AND ', $sqlwhere);
}
$sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset);
$this->lines = array ();
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql))
{
$line=new Skeleton_ClassLine();
$line->id = $obj->rowid;
$line->prop1 = $obj->field1;
$line->prop2 = $obj->field2;
$this->line[]=$line;
//...
}
$this->db->free($resql);
return $num;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR);
return -1;
}
}
/** /**
* Update object into database * Update object into database
@ -368,3 +429,10 @@ class Skeleton_Class extends CommonObject
} }
} }
class Skeleton_ClassLine
{
var $id;
var $prop1;
var $prop2;
}

View File

@ -25,7 +25,7 @@
* *
* Usage: * Usage:
* cd htdocs/langs * cd htdocs/langs
* ../../dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all] * ./dev/translation/strip_language_file.php <primary_lang_dir> <secondary_lang_dir> [file.lang|all]
* *
* To rename all .delta files, you can do * To rename all .delta files, you can do
* for fic in `ls *.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done * for fic in `ls *.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
@ -60,24 +60,26 @@ $rc = 0;
$lPrimary = isset($argv[1])?$argv[1]:''; $lPrimary = isset($argv[1])?$argv[1]:'';
$lSecondary = isset($argv[2])?$argv[2]:''; $lSecondary = isset($argv[2])?$argv[2]:'';
$lEnglish = 'en_US';
$filesToProcess = isset($argv[3])?$argv[3]:''; $filesToProcess = isset($argv[3])?$argv[3]:'';
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess)) if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess))
{ {
$rc = 1; $rc = 1;
$msg = '***** Script to clean language files *****'."\n"; $msg = '***** Script to clean language files *****'."\n";
$msg.= 'Usage: ../../dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n"; $msg.= 'Usage: ./dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n";
print $msg . "(rc=$rc).\n"; print $msg . "(rc=$rc).\n";
exit($rc); exit($rc);
} }
$aPrimary = array(); $aPrimary = array();
$aSecondary = array(); $aSecondary = array();
$aEnglish = array();
// Define array $filesToProcess // Define array $filesToProcess
if ($filesToProcess == 'all') if ($filesToProcess == 'all')
{ {
$dir = new DirectoryIterator($lPrimary); $dir = new DirectoryIterator('htdocs/langs/'.$lPrimary);
while($dir->valid()) { while($dir->valid()) {
if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) { if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./',$dir->getFilename())) {
$files[] = $dir->getFilename(); $files[] = $dir->getFilename();
@ -94,8 +96,9 @@ else $filesToProcess=explode(',',$filesToProcess);
// Loop on each file // Loop on each file
foreach($filesToProcess as $fileToProcess) foreach($filesToProcess as $fileToProcess)
{ {
$lPrimaryFile = $lPrimary.'/'.$fileToProcess; $lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess;
$lSecondaryFile = $lSecondary.'/'.$fileToProcess; $lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess;
$lEnglishFile = 'htdocs/langs/'.$lEnglish.'/'.$fileToProcess;
$output = $lSecondaryFile . '.delta'; $output = $lSecondaryFile . '.delta';
print "---- Process language file ".$lSecondaryFile."\n"; print "---- Process language file ".$lSecondaryFile."\n";
@ -114,6 +117,13 @@ foreach($filesToProcess as $fileToProcess)
continue; continue;
} }
if ( ! is_readable($lEnglishFile) ) {
$rc = 3;
$msg = "Cannot read english language file $lEnglishFile. We discard this file.";
print $msg . "\n";
continue;
}
// Start reading and parsing Secondary // Start reading and parsing Secondary
if ( $handle = fopen($lSecondaryFile, 'r') ) if ( $handle = fopen($lSecondaryFile, 'r') )
@ -172,6 +182,65 @@ foreach($filesToProcess as $fileToProcess)
} }
// Start reading and parsing English
if ( $handle = fopen($lEnglishFile, 'r') )
{
print "Read English File $lEnglishFile:\n";
$cnt = 0;
while (($line = fgets($handle)) !== false)
{
$cnt++;
// strip comments
if ( preg_match("/^\w*#/", $line) ) {
continue;
}
// strip empty lines
if ( preg_match("/^\w*$/", $line) ) {
continue;
}
$a = mb_split('=', trim($line), 2);
if ( count($a) != 2 ) {
print "ERROR in file $lEnglishFile, line $cnt: " . trim($line) . "\n";
continue;
}
list($key, $value) = $a;
// key is redundant
if ( array_key_exists($key, $aEnglish) ) {
print "Key $key is redundant in file $lEnglishFile (line: $cnt).\n";
continue;
}
// String has no value
if ( $value == '' ) {
print "Key $key has no value in file $lEnglishFile (line: $cnt).\n";
continue;
}
$aEnglish[$key] = trim($value);
}
if ( ! feof($handle) )
{
$rc = 5;
$msg = "Unexpected fgets() fail";
print $msg . " (rc=$rc).\n";
exit($rc);
}
fclose($handle);
}
else {
$rc = 6;
$msg = "Cannot open file $lEnglishFile";
print $msg . " (rc=$rc).\n";
exit($rc);
}
// Start reading and parsing Primary. See rules in header! // Start reading and parsing Primary. See rules in header!
$arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand'); $arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand');
@ -246,7 +315,11 @@ foreach($filesToProcess as $fileToProcess)
} }
// String exists in both files and does not match // String exists in both files and does not match
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]) || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)) if (
(! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
)
{ {
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n"; //print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n"); fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
@ -270,8 +343,8 @@ foreach($filesToProcess as $fileToProcess)
print "Output can be found at $output.\n"; print "Output can be found at $output.\n";
print "To rename all .delta files, you can do\n"; print "To rename all .delta files, you can do:\n";
print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n"; print '> for fic in `ls htdocs/langs/'.$lSecondary.'/*.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
} }

View File

@ -13,7 +13,7 @@ then
echo "This pull remote transifex files to local dir." echo "This pull remote transifex files to local dir."
echo "Note: If you pull a language file (not source), file will be skipped if local file is newer." echo "Note: If you pull a language file (not source), file will be skipped if local file is newer."
echo " Using -f will overwrite local file (does not work with 'all')." echo " Using -f will overwrite local file (does not work with 'all')."
echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]" echo "Usage: ./dev/translation/txpull.sh (all|xx_XX) [-r dolibarr.file] [-f] [-s]"
exit exit
fi fi
@ -26,13 +26,21 @@ fi
if [ "x$1" = "xall" ] if [ "x$1" = "xall" ]
then then
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ka_GE ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW cd htdocs/lang
for dir in `find htdocs/langs/* -type d`
do do
echo "tx pull -l $fic $2 $3" fic=`basename $dir`
tx pull -l $fic $2 $3 if [ $fic != "en_US" ]
then
echo "tx pull -l $fic $2 $3"
tx pull -l $fic $2 $3
fi
done done
cd -
else else
echo "tx pull -l $1 $2 $3 $4" echo "tx pull -l $1 $2 $3 $4 $5"
tx pull -l $1 $2 $3 $4 tx pull -l $1 $2 $3 $4 $5
fi fi
echo Think to launch also:
echo "> dev/fixaltlanguages.sh fix all"

View File

@ -249,7 +249,11 @@ if ($action == 'export_csv')
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
header('Content-Type: text/csv'); header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_achats.csv'); if ($conf->global->EXPORT_PREFIX_SPEC)
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_achats.csv";
else
$filename="journal_achats.csv";
header('Content-Disposition: attachment;filename='.$filename);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{ {

View File

@ -271,7 +271,11 @@ if ($action == 'export_csv')
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
header('Content-Type: text/csv'); header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_ventes.csv'); if ($conf->global->EXPORT_PREFIX_SPEC)
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_ventes.csv";
else
$filename="journal_ventes.csv";
header('Content-Disposition: attachment;filename='.$filename);
$companystatic = new Client($db); $companystatic = new Client($db);

View File

@ -1548,9 +1548,9 @@ class Adherent extends CommonObject
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max libelle * @param int $maxlen length max libelle
* @param string $option Page lien * @param string $option Page lien
* @return string Chaine avec URL * @return string Chaine avec URL
@ -1568,25 +1568,25 @@ class Adherent extends CommonObject
if ($option == 'card') if ($option == 'card')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
$lienfin='</a>'; $linkend='</a>';
} }
if ($option == 'subscription') if ($option == 'subscription')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
$lienfin='</a>'; $linkend='</a>';
} }
if ($option == 'category') if ($option == 'category')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose;
$lienfin='</a>'; $linkend='</a>';
} }
$picto='user'; $picto='user';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin; $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
return $result; return $result;
} }

View File

@ -266,9 +266,9 @@ class AdherentType extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max libelle * @param int $maxlen length max libelle
* @return string String with URL * @return string String with URL
*/ */
@ -279,14 +279,14 @@ class AdherentType extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowTypeCard",$this->libelle); $label=$langs->trans("ShowTypeCard",$this->libelle);
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='group'; $picto='group';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$lienfin; $result.=$link.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$linkend;
return $result; return $result;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -90,7 +90,7 @@ class Cotisation extends CommonObject
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
@ -140,7 +140,7 @@ class Cotisation extends CommonObject
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
@ -181,7 +181,7 @@ class Cotisation extends CommonObject
else else
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
@ -217,7 +217,7 @@ class Cotisation extends CommonObject
$result=$member->fetch($this->fk_adherent); $result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user); $result=$member->update_end_date($user);
if ($accountline->rowid > 0) // If we found bank account line (this means this->fk_bank defined) if ($accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{ {
$result=$accountline->delete($user); // Return false if refused because line is conciliated $result=$accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0) if ($result > 0)
@ -254,9 +254,9 @@ class Cotisation extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
@ -266,14 +266,14 @@ class Cotisation extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowSubscription").': '.$this->ref; $label=$langs->trans("ShowSubscription").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='payment'; $picto='payment';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.$this->ref.$lienfin; $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -622,9 +622,29 @@ else
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -229,7 +229,7 @@ $sql.= ", note";
$sql.= ", entity"; $sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
if (empty($user->entity) && $debug) {} // to force for superadmin if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin
else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
$sql.= " ORDER BY entity, name ASC"; $sql.= " ORDER BY entity, name ASC";

View File

@ -630,7 +630,6 @@ print '</table>';
/* /*
* Modes de reglement * Modes de reglement
*
*/ */
print '<br>'; print '<br>';
print_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice")); print_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
@ -811,7 +810,27 @@ print '</tr>'."\n";
print "</table>\n"; print "</table>\n";
//dol_fiche_end(); /*
* Notifications
*/
print '<br>';
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
dol_fiche_end();
llxFooter(); llxFooter();

View File

@ -162,11 +162,11 @@ $var=true;
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{ {
//$lien=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">';
//$lien.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
$lien.=img_picto($langs->trans("Activated"),'switch_on'); $link.=img_picto($langs->trans("Activated"),'switch_on');
$lien.='</a>'; $link.='</a>';
// Edition des varibales globales // Edition des varibales globales
$constantes=array( $constantes=array(
'ADHERENT_MAILMAN_ADMINPW', 'ADHERENT_MAILMAN_ADMINPW',
@ -175,7 +175,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
'ADHERENT_MAILMAN_LISTS' 'ADHERENT_MAILMAN_LISTS'
); );
print_fiche_titre($langs->trans('MailmanTitle'), $lien,''); print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
print '<br>'; print '<br>';
@ -207,11 +207,11 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
} }
else else
{ {
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';
//$lien.=img_$langs->trans("Activate") //$link.=img_$langs->trans("Activate")
$lien.=img_picto($langs->trans("Disabled"),'switch_off'); $link.=img_picto($langs->trans("Disabled"),'switch_off');
$lien.='</a>'; $link.='</a>';
print_fiche_titre($langs->trans('MailmanTitle'), $lien,''); print_fiche_titre($langs->trans('MailmanTitle'), $link,'');
} }
dol_fiche_end(); dol_fiche_end();

View File

@ -120,7 +120,7 @@ print "</td>";
print '</tr>'; print '</tr>';
// Use a flip-hide menu // Use a flip-hide menu
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 1)
{ {
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";

View File

@ -24,6 +24,7 @@
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Notification.class.php';
@ -48,25 +49,56 @@ $action = GETPOST("action");
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$db->begin();
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity); $result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
if ($result < 0) $error++; if ($result < 0) $error++;
if (! $error) if (! $error)
{ {
//var_dump($_POST);
foreach($_POST as $key => $val) foreach($_POST as $key => $val)
{ {
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue; if (! preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
//print $key.' - '.$val.'<br>';
$result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity); $newval='';
$newkey='';
$shortkey=preg_replace('/_key$/','',$key);
//print $shortkey.'<br>';
if (preg_match('/^NOTIF_(.*)_old_(.*)_key/',$key,$reg))
{
dolibarr_del_const($db, 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.$reg[2], $conf->entity);
$newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval=GETPOST($shortkey.'_key');
//print $newkey.' - '.$newval.'<br>';
}
else if (preg_match('/^NOTIF_(.*)_new_key/',$key,$reg))
{
// Add a new entry
$newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval=GETPOST($shortkey.'_key');
}
if ($newkey && $newval)
{
$result=dolibarr_set_const($db, $newkey, $newval, 'chaine', 0, '', $conf->entity);
}
} }
} }
if (! $error) if (! $error)
{ {
$db->commit();
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback();
setEventMessage($langs->trans("Error"),'errors'); setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -78,6 +110,7 @@ if ($action == 'setvalue' && $user->admin)
*/ */
$form=new Form($db); $form=new Form($db);
$notify = new Notify($db);
llxHeader('',$langs->trans("NotificationSetup")); llxHeader('',$langs->trans("NotificationSetup"));
@ -107,7 +140,53 @@ print '</table>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'','');
if ($conf->societe->enabled)
{
print_fiche_titre($langs->trans("ListOfNotificationsPerContact"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
print '<td>'.'</td>';
print "</tr>\n";
// Load array of available notifications
$notificationtrigger=new InterfaceNotification($db);
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
$var=true;
foreach($listofnotifiedevents as $notifiedevent)
{
$var=!$var;
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
print '<tr '.$bc[$var].'>';
print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td align="right">';
$nb = $notify->countDefinedNotifications($notifiedevent['code'], 0);
print $nb;
print '</td>';
print '</tr>';
}
print '</table>';
print '* '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
print '<br>';
}
print_fiche_titre($langs->trans("ListOfFixedNotifications"),'','');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -115,12 +194,15 @@ print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("Code").'</td>'; print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("FixedEmailTarget").'</td>'; print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
print '<td>'.$langs->trans("Threshold").'</td>';
print '<td>'.'</td>';
print "</tr>\n"; print "</tr>\n";
// Load array of available notifications // Load array of available notifications
$notificationtrigger=new InterfaceNotification($db); $notificationtrigger=new InterfaceNotification($db);
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
$var=true;
foreach($listofnotifiedevents as $notifiedevent) foreach($listofnotifiedevents as $notifiedevent)
{ {
$var=!$var; $var=!$var;
@ -136,18 +218,47 @@ foreach($listofnotifiedevents as $notifiedevent)
print '<td>'.$notifiedevent['code'].'</td>'; print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
print '<td>'; print '<td>';
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code']; // Notification with threshold
$value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param; foreach($conf->global as $key => $val)
$s='<input type="text" size="32" name="'.$param.'" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator. {
$arrayemail=explode(',',$value); if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
$showwarning=0;
foreach($arrayemail as $key=>$valuedet) $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1];
{ $value=GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key')?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key','alpha'):$conf->global->$param;
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++; $s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
} $arrayemail=explode(',',$value);
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail")); $showwarning=0;
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); foreach($arrayemail as $key=>$valuedet)
{
$valuedet=trim($valuedet);
if (! empty($valuedet) && ! isValidEmail($valuedet,1)) $showwarning++;
}
if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail"));
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"),1,'help','',0,2);
print '<br>';
}
// New entry input fields
$s='<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"),1,'help','',0,2);
print '</td>';
print '<td>';
// Notification with threshold
foreach($conf->global as $key => $val)
{
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
}
// New entry input fields
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
print '</td>';
print '<td>';
// TODO Add link to show message content
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -643,6 +643,27 @@ print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n"; print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n";
print "</table>\n<br>"; print "</table>\n<br>";
$db->close();
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter(); llxFooter();
$db->close();

View File

@ -124,11 +124,11 @@ $var=true;
*/ */
if (! empty($conf->global->ADHERENT_USE_SPIP)) if (! empty($conf->global->ADHERENT_USE_SPIP))
{ {
//$lien=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
//$lien.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
$lien.=img_picto($langs->trans("Activated"),'switch_on'); $link.=img_picto($langs->trans("Activated"),'switch_on');
$lien.='</a>'; $link.='</a>';
// Edition des varibales globales // Edition des varibales globales
$constantes=array( $constantes=array(
'ADHERENT_SPIP_SERVEUR', 'ADHERENT_SPIP_SERVEUR',
@ -137,18 +137,18 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
'ADHERENT_SPIP_PASS' 'ADHERENT_SPIP_PASS'
); );
print_fiche_titre($langs->trans('SPIPTitle'), $lien, ''); print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
print '<br>'; print '<br>';
form_constantes($constantes); form_constantes($constantes);
print '<br>'; print '<br>';
} }
else else
{ {
$lien='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'; $link='<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
//$lien.=$langs->trans("Activate"); //$link.=$langs->trans("Activate");
$lien.=img_picto($langs->trans("Disabled"),'switch_off'); $link.=img_picto($langs->trans("Disabled"),'switch_off');
$lien.='</a>'; $link.='</a>';
print_fiche_titre($langs->trans('SPIPTitle'), $lien, ''); print_fiche_titre($langs->trans('SPIPTitle'), $link, '');
} }

View File

@ -443,14 +443,16 @@ foreach ($dirmodels as $reldir)
} }
} }
print '</table><br/>'; print '</table><br>';
print '<br>';
/* /*
* Other options * Other options
*
*/ */
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_SUPPLIER_INVOICE_FREE_TEXT">';
print_titre($langs->trans("OtherOptions")); print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -459,16 +461,38 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
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_SUPPLIER_INVOICE_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">'; print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>'; print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_INVOICE_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_INVOICE_FREE_TEXT.'</textarea>'; print '<textarea name="SUPPLIER_INVOICE_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_INVOICE_FREE_TEXT.'</textarea>';
print '</td><td align="right">'; print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n"; print "</td></tr>\n";
print '</table><br>';
print '</form>'; print '</form>';
$db->close();
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter(); llxFooter();
$db->close();

View File

@ -439,14 +439,16 @@ foreach ($dirmodels as $reldir)
} }
} }
print '</table><br/>'; print '</table><br>';
print '<br>';
/* /*
* Other options * Other options
*
*/ */
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_SUPPLIER_ORDER_FREE_TEXT">';
print_titre($langs->trans("OtherOptions")); print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -455,16 +457,39 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
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_SUPPLIER_ORDER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">'; print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>'; print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>'; print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
print '</td><td align="right">'; print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n"; print "</td></tr>\n";
print '</table><br>';
print '</form>'; print '</form>';
$db->close();
/*
* Notifications
*/
print_titre($langs->trans("Notifications"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td align="right">';
print "</td></tr>\n";
print '</table>';
llxFooter(); llxFooter();
$db->close();

View File

@ -179,7 +179,7 @@ $c=getServerTimeZoneInt('summer');
$daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown'; $daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
//print $a." ".$b." ".$c." ".$daylight; //print $a." ".$b." ".$c." ".$daylight;
$val=($a>=0?'+':'').$a; $val=($a>=0?'+':'').$a;
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')'; $val.=' ('.($a=='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
$val.=' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString(); $val.=' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val.=' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')':''))); $val.=' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')':'')));
print $form->textwithtooltip($val,$txt,2,1,img_info('')); print $form->textwithtooltip($val,$txt,2,1,img_info(''));

View File

@ -24,6 +24,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
@ -105,7 +106,41 @@ llxHeader('',$langs->trans("Upgrade"),$wikihelp);
print_fiche_titre($langs->trans("Upgrade"),'','setup'); print_fiche_titre($langs->trans("Upgrade"),'','setup');
print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>'; print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("FeatureNotYetAvailable").'</b><br>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
{
$title=$sfurl->channel[0]->item[0]->title;
function word_limiter($text, $limit = 30, $chars = '0123456789.')
{
if (strlen( $text ) > $limit)
{
$words = str_word_count($text, 2, $chars);
$words = array_reverse($words, TRUE);
foreach($words as $length => $word) {
if ($length + strlen( $word ) >= $limit)
{
array_shift($words);
} else {
break;
}
}
$words = array_reverse($words);
$text = implode(" ", $words) . '';
}
return $text;
}
$str = $title;
print $langs->trans("LastStableVersion").' : <b>'. word_limiter( $str ).'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
}
print '<br>'; print '<br>';
print $langs->trans("Upgrade").'<br>'; print $langs->trans("Upgrade").'<br>';

View File

@ -119,17 +119,17 @@ if ($resql)
print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>"; print "<a href=\"card.php?id=".$obj->bid."\">".img_object($langs->trans("ShowBookmark"),"bookmark").' '.$obj->bid."</a>";
print '</td>'; print '</td>';
$lieninterne=0; $linkintern=0;
$title=dol_trunc($obj->title,24); $title=dol_trunc($obj->title,24);
$lien=dol_trunc($obj->url,24); $link=dol_trunc($obj->url,24);
// Title // Title
print "<td>"; print "<td>";
if ($obj->rowid) if ($obj->rowid)
{ {
// Lien interne societe // Lien interne societe
$lieninterne=1; $linkintern=1;
$lien="Dolibarr"; $link="Dolibarr";
if (! $obj->title) if (! $obj->title)
{ {
// For compatibility with old Dolibarr bookmarks // For compatibility with old Dolibarr bookmarks
@ -140,16 +140,16 @@ if ($resql)
} }
$title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title; $title=img_object($langs->trans("ShowCompany"),"company").' '.$obj->title;
} }
if ($lieninterne) print "<a href=\"".$obj->url."\">"; if ($linkintern) print "<a href=\"".$obj->url."\">";
print $title; print $title;
if ($lieninterne) print "</a>"; if ($linkintern) print "</a>";
print "</td>\n"; print "</td>\n";
// Url // Url
print "<td>"; print "<td>";
if (! $lieninterne) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>'; if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
print $lien; print $link;
if (! $lieninterne) print '</a>'; if (! $linkintern) print '</a>';
print "</td>\n"; print "</td>\n";
// Target // Target

View File

@ -235,7 +235,9 @@ if ($socid)
$soc = new Societe($db); $soc = new Societe($db);
$result = $soc->fetch($socid); $result = $soc->fetch($socid);
llxHeader("","",$langs->trans("Category")); $title=$langs->trans("Category");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$soc->name." - ".$title;
llxHeader("",$title);
// Show tabs // Show tabs
$head = societe_prepare_head($soc); $head = societe_prepare_head($soc);

View File

@ -1000,7 +1000,7 @@ class Categorie extends CommonObject
/** /**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type * Check if no category with same label already exists for this cat's parent or root and for this cat's type
* *
* @return boolean 1 if already exist, 0 otherwise, -1 if error * @return integer 1 if already exist, 0 otherwise, -1 if error
*/ */
function already_exists() function already_exists()
{ {
@ -1265,7 +1265,7 @@ class Categorie extends CommonObject
/** /**
* Return name and link of category (with picto) * Return name and link of category (with picto)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'xyz') * @param string $option Sur quoi pointe le lien ('', 'xyz')
* @param int $maxlength Max length of text * @param int $maxlength Max length of text
* @return string Chaine avec URL * @return string Chaine avec URL
@ -1277,15 +1277,15 @@ class Categorie extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
$lien = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='category'; $picto='category';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin; if ($withpicto != 2) $result.=$link.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$linkend;
return $result; return $result;
} }
@ -1295,11 +1295,9 @@ class Categorie extends CommonObject
* *
* @param string $sdir Repertoire destination finale * @param string $sdir Repertoire destination finale
* @param string $file Nom du fichier uploade * @param string $file Nom du fichier uploade
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void * @return void
*/ */
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) function add_photo($sdir, $file)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1321,36 +1319,11 @@ class Categorie extends CommonObject
if (file_exists($originImage)) if (file_exists($originImage))
{ {
// Cree fichier en taille vignette // Cree fichier en taille vignette
$this->add_thumb($originImage,$maxWidth,$maxHeight); $this->add_thumb($originImage);
} }
} }
} }
/**
* Build thumb
*
* @param string $file Chemin du fichier d'origine
* @return void
*/
function add_thumb($file)
{
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
if (file_exists($file))
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
/** /**
* Return tableau de toutes les photos de la categorie * Return tableau de toutes les photos de la categorie
* *

View File

@ -957,7 +957,7 @@ class ActionComm extends CommonObject
* Return URL of event * Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label * Use $this->id, $this->type_code, $this->label and $this->type_label
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Nombre de caracteres max dans libelle * @param int $maxlength Nombre de caracteres max dans libelle
* @param string $classname Force style class on a link * @param string $classname Force style class on a link
* @param string $option ''=Link to action,'birthday'=Link to contact * @param string $option ''=Link to action,'birthday'=Link to contact
@ -974,9 +974,9 @@ class ActionComm extends CommonObject
$label = $this->label; $label = $this->label;
if (empty($label)) $label=$this->libelle; // For backward compatibility if (empty($label)) $label=$this->libelle; // For backward compatibility
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">';
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose; if ($option=='birthday') $link = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose; else $link = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
$lienfin='</a>'; $linkend='</a>';
//print 'rrr'.$this->libelle.'-'.$withpicto; //print 'rrr'.$this->libelle.'-'.$withpicto;
if ($withpicto == 2) if ($withpicto == 2)
@ -998,10 +998,10 @@ class ActionComm extends CommonObject
{ {
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
} }
$result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$lienfin; $result.=$link.img_object($langs->trans("ShowAction").': '.$libelle, ($overwritepicto?$overwritepicto:'action'), 'class="classfortooltip"').$linkend;
} }
if ($withpicto==1) $result.=' '; if ($withpicto==1) $result.=' ';
$result.=$lien.$libelleshort.$lienfin; $result.=$link.$libelleshort.$linkend;
return $result; return $result;
} }

View File

@ -614,7 +614,7 @@ else
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
$sql.= " WHERE u.entity IN (".getEntity('user',1).")"; $sql.= " WHERE u.entity IN (".getEntity('user',1).")";
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup; if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3); //if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
//print $sql; //print $sql;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -1337,7 +1337,7 @@ if ($action == 'create')
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
$text .= $notify->confirmMessage('ASKPRICESUPPLIER_VALIDATE', $object->socid); $text .= $notify->confirmMessage('ASKPRICESUPPLIER_VALIDATE', $object->socid, $object);
} }
if (! $error) if (! $error)
@ -1346,9 +1346,9 @@ if ($action == 'create')
if (! $formconfirm) { if (! $formconfirm) {
$parameters = array('lineid' => $lineid); $parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// by if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
// hook elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
} }
// Print form confirm // Print form confirm

View File

@ -185,7 +185,7 @@ class AskPriceSupplier extends CommonObject
$price = $prod->price; $price = $prod->price;
} }
$line = new AskPriceSupplierLigne($this->db); $line = new AskPriceSupplierLine($this->db);
$line->fk_product=$idproduct; $line->fk_product=$idproduct;
$line->desc=$productdesc; $line->desc=$productdesc;
@ -225,7 +225,7 @@ class AskPriceSupplier extends CommonObject
return -5; return -5;
} }
$askpricesupplierligne=new AskPriceSupplierLigne($this->db); $askpricesupplierligne=new AskPriceSupplierLine($this->db);
$askpricesupplierligne->fk_askpricesupplier=$this->id; $askpricesupplierligne->fk_askpricesupplier=$this->id;
$askpricesupplierligne->fk_remise_except=$remise->id; $askpricesupplierligne->fk_remise_except=$remise->id;
$askpricesupplierligne->desc=$remise->description; // Description ligne $askpricesupplierligne->desc=$remise->description; // Description ligne
@ -376,7 +376,7 @@ class AskPriceSupplier extends CommonObject
} }
// Insert line // Insert line
$this->line=new AskPriceSupplierLigne($this->db); $this->line=new AskPriceSupplierLine($this->db);
$this->line->fk_askpricesupplier=$this->id; $this->line->fk_askpricesupplier=$this->id;
$this->line->label=$label; $this->line->label=$label;
@ -525,10 +525,10 @@ class AskPriceSupplier extends CommonObject
} }
// Update line // Update line
$this->line=new AskPriceSupplierLigne($this->db); $this->line=new AskPriceSupplierLine($this->db);
// Stock previous line records // Stock previous line records
$staticline=new AskPriceSupplierLigne($this->db); $staticline=new AskPriceSupplierLine($this->db);
$staticline->fetch($rowid); $staticline->fetch($rowid);
$this->line->oldline = $staticline; $this->line->oldline = $staticline;
@ -621,7 +621,7 @@ class AskPriceSupplier extends CommonObject
{ {
if ($this->statut == 0) if ($this->statut == 0)
{ {
$line=new AskPriceSupplierLigne($this->db); $line=new AskPriceSupplierLine($this->db);
// For triggers // For triggers
$line->fetch($lineid); $line->fetch($lineid);
@ -1106,7 +1106,7 @@ class AskPriceSupplier extends CommonObject
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$line = new AskPriceSupplierLigne($this->db); $line = new AskPriceSupplierLine($this->db);
$line->rowid = $objp->rowid; $line->rowid = $objp->rowid;
$line->fk_askpricesupplier = $objp->fk_askpricesupplier; $line->fk_askpricesupplier = $objp->fk_askpricesupplier;
@ -2088,7 +2088,7 @@ class AskPriceSupplier extends CommonObject
$xnbp = 0; $xnbp = 0;
while ($xnbp < $nbp) while ($xnbp < $nbp)
{ {
$line=new AskPriceSupplierLigne($this->db); $line=new AskPriceSupplierLine($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp; $line->desc=$langs->trans("Description")." ".$xnbp;
$line->qty=1; $line->qty=1;
$line->subprice=100; $line->subprice=100;
@ -2240,21 +2240,21 @@ class AskPriceSupplier extends CommonObject
$label=$langs->trans("ShowAskpricesupplier").': '.$this->ref; $label=$langs->trans("ShowAskpricesupplier").': '.$this->ref;
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') { if ($option == '') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$this->id. $get_params .$linkclose;
} }
if ($option == 'document') { if ($option == 'document') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$this->id. $get_params .$linkclose;
} }
$lienfin='</a>'; $linkend='</a>';
$picto='askpricesupplier'; $picto='askpricesupplier';
if ($withpicto) if ($withpicto)
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) if ($withpicto && $withpicto != 2)
$result.=' '; $result.=' ';
$result.=$lien.$this->ref.$lienfin; $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }
@ -2287,7 +2287,7 @@ class AskPriceSupplier extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->lines[$i] = new AskPriceSupplierLigne($this->db); $this->lines[$i] = new AskPriceSupplierLine($this->db);
$this->lines[$i]->id = $obj->rowid; // for backward compatibility $this->lines[$i]->id = $obj->rowid; // for backward compatibility
$this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->label = $obj->custom_label; $this->lines[$i]->label = $obj->custom_label;
@ -2412,10 +2412,10 @@ class AskPriceSupplier extends CommonObject
/** /**
* \class AskPriceSupplierLigne * \class AskPriceSupplierLine
* \brief Class to manage askpricesupplier lines * \brief Class to manage askpricesupplier lines
*/ */
class AskPriceSupplierLigne extends CommonObject class AskPriceSupplierLine extends CommonObject
{ {
var $db; var $db;
var $error; var $error;
@ -2689,7 +2689,7 @@ class AskPriceSupplierLigne extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."askpricesupplierdet WHERE rowid = ".$this->rowid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."askpricesupplierdet WHERE rowid = ".$this->rowid;
dol_syslog("AskPriceSupplierLigne::delete", LOG_DEBUG); dol_syslog("AskPriceSupplierLine::delete", LOG_DEBUG);
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
@ -2852,7 +2852,7 @@ class AskPriceSupplierLigne extends CommonObject
$sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; $sql.= ",total_ttc=".price2num($this->total_ttc,'MT')."";
$sql.= " WHERE rowid = ".$this->rowid; $sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("AskPriceSupplierLigne::update_total", LOG_DEBUG); dol_syslog("AskPriceSupplierLine::update_total", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -31,6 +31,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -68,10 +69,15 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="nom"; if (! $sortfield) $sortfield="nom";
$cancelbutton = GETPOST('cancel'); $cancelbutton = GETPOST('cancel');
$object = new Client($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('commcard','globalcard')); $hookmanager->initHooks(array('commcard','globalcard'));
$object = new Societe($db);
/* /*
* Actions * Actions
@ -215,7 +221,6 @@ if ($id > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">'; print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
$object->next_prev_filter="te.client in (1,2,3)";
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>'; print '</td></tr>';
@ -425,9 +430,9 @@ if ($id > 0)
print '</tr>'; print '</tr>';
} }
// Level of prospect
if ($object->client == 2 || $object->client == 3) if ($object->client == 2 || $object->client == 3)
{ {
// Level of prospect
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('ProspectLevel'); print $langs->trans('ProspectLevel');
@ -453,7 +458,16 @@ if ($id > 0)
print '</td></tr>'; print '</td></tr>';
} }
// Sales representative // Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
// Sales representative
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent // Module Adherent

View File

@ -779,8 +779,21 @@ if (empty($reshook))
$desc = dol_concatdesc($desc, $product_desc); $desc = dol_concatdesc($desc, $product_desc);
// Add dimensions into product description
/*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM))
{
$text='';
if ($prod->weight) $text.=($text?"\n":"").$outputlangs->trans("Weight").': '.$prod->weight.' '.$prod->weight_units;
if ($prod->length) $text.=($text?"\n":"").$outputlangs->trans("Length").': '.$prod->length.' '.$prod->length_units;
if ($prod->surface) $text.=($text?"\n":"").$outputlangs->trans("Surface").': '.$prod->surface.' '.$prod->surface_units;
if ($prod->volume) $text.=($text?"\n":"").$outputlangs->trans("Volume").': '.$prod->volume.' '.$prod->volume_units;
$desc = dol_concatdesc($desc, $text);
}*/
// Add custom code and origin country into description // Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
$tmptxt = '('; $tmptxt = '(';
if (! empty($prod->customcode)) if (! empty($prod->customcode))
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
@ -1658,7 +1671,7 @@ if ($action == 'create')
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
$text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid); $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
} }
if (! $error) if (! $error)
@ -1667,9 +1680,9 @@ if ($action == 'create')
if (! $formconfirm) { if (! $formconfirm) {
$parameters = array('lineid' => $lineid); $parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// by if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
// hook elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
} }
// Print form confirm // Print form confirm

View File

@ -2658,27 +2658,27 @@ class Propal extends CommonObject
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') { if ($option == '') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
} }
if ($option == 'compta') { // deprecated if ($option == 'compta') { // deprecated
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
} }
if ($option == 'expedition') { if ($option == 'expedition') {
$lien = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
} }
if ($option == 'document') { if ($option == 'document') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params .$linkclose;
} }
$lienfin='</a>'; $linkend='</a>';
$picto='propal'; $picto='propal';
if ($withpicto) if ($withpicto)
$result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) if ($withpicto && $withpicto != 2)
$result.=' '; $result.=' ';
$result.=$lien.$this->ref.$lienfin; $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -399,7 +399,8 @@ if ($resql)
print "</td></tr>\n"; print "</td></tr>\n";
$parameters=array(); $parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</tr>\n"; print "</tr>\n";

View File

@ -1600,7 +1600,7 @@ if ($action == 'create' && $user->rights->commande->creer)
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid); $text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid, $object);
} }
$qualified_for_stock_change=0; $qualified_for_stock_change=0;
@ -1726,8 +1726,9 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! $formconfirm) { if (! $formconfirm) {
$parameters = array('lineid' => $lineid); $parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// by hook if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
} }
// Print form confirm // Print form confirm
@ -2044,7 +2045,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Total HT // Total HT
print '<tr><td>' . $langs->trans('AmountHT') . '</td>'; print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>'; print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
// Margin Infos // Margin Infos
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
@ -2056,23 +2057,23 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</tr>'; print '</tr>';
// Total TVA // Total VAT
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td align="right">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
// Amount Local Taxes // Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
{ {
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td align="right">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; print '<td>' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
} }
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
{ {
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td align="right">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; print '<td>' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
} }
// Total TTC // Total TTC
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td align="right">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>'; print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td>' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
// Statut // Statut
print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>'; print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -111,6 +111,16 @@ class Commande extends CommonOrder
var $location_incoterms; var $location_incoterms;
var $libelle_incoterms; //Used into tooltip var $libelle_incoterms; //Used into tooltip
// Pour board
var $nbtodo;
var $nbtodolate;
/**
* ERR Not engouch stock
*/
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
/** /**
* Constructor * Constructor
@ -624,8 +634,8 @@ class Commande extends CommonOrder
* Note that this->ref can be set or empty. If empty, we will use "(PROV)" * Note that this->ref can be set or empty. If empty, we will use "(PROV)"
* *
* @param User $user Objet user that make creation * @param User $user Objet user that make creation
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
@ -633,22 +643,22 @@ class Commande extends CommonOrder
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->brouillon = 1; // On positionne en mode brouillon la commande $this->brouillon = 1; // set command as draft
dol_syslog(get_class($this)."::create user=".$user->id); dol_syslog(get_class($this)."::create user=".$user->id);
// Check parameters // Check parameters
if (! empty($this->ref)) // We check that ref is not already used if (! empty($this->ref)) // We check that ref is not already used
{ {
$result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used $result=self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
if ($result > 0) if ($result > 0)
{ {
$this->error='ErrorRefAlreadyExists'; $this->error='ErrorRefAlreadyExists';
dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING); dol_syslog(get_class($this)."::create ".$this->error,LOG_WARNING);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
$soc = new Societe($this->db); $soc = new Societe($this->db);
$result=$soc->fetch($this->socid); $result=$soc->fetch($this->socid);
@ -677,7 +687,7 @@ class Commande extends CommonOrder
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql.= ", fk_shipping_method"; $sql.= ", fk_shipping_method";
$sql.= ", remise_absolue, remise_percent"; $sql.= ", remise_absolue, remise_percent";
$sql.= ", fk_incoterms, location_incoterms"; $sql.= ", fk_incoterms, location_incoterms";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ")"; $sql.= ")";
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id; $sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
@ -717,7 +727,7 @@ class Commande extends CommonOrder
$num=count($this->lines); $num=count($this->lines);
/* /*
* Insertion du detail des produits dans la base * Insert products details into db
*/ */
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
@ -748,12 +758,15 @@ class Commande extends CommonOrder
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label, $this->lines[$i]->label,
$this->lines[$i]->array_options $this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
{ {
$this->error=$this->db->lasterror(); if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
dol_print_error($this->db); {
$this->error=$this->db->lasterror();
dol_print_error($this->db);
}
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -763,13 +776,16 @@ class Commande extends CommonOrder
} }
} }
// Mise a jour ref // update ref
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; $initialref='(PROV'.$this->id.')';
if (! empty($this->ref)) $initialref=$this->ref;
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
if ($this->id) if ($this->id)
{ {
$this->ref="(PROV".$this->id.")"; $this->ref = $initialref;
// Add object linked // Add object linked
if (is_array($this->linked_objects) && ! empty($this->linked_objects)) if (is_array($this->linked_objects) && ! empty($this->linked_objects))
@ -1192,10 +1208,12 @@ class Commande extends CommonOrder
$result=$product->fetch($fk_product); $result=$product->fetch($fk_product);
$product_type=$product->type; $product_type=$product->type;
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty) { if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty)
{
$this->error=$langs->trans('ErrorStockIsNotEnough'); $this->error=$langs->trans('ErrorStockIsNotEnough');
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return self::STOCK_NOT_ENOUGH_FOR_ORDER;
} }
} }

View File

@ -158,12 +158,12 @@ if ($resql)
print '<td>'; print '<td>';
$result=''; $result='';
$lien=$lienfin=''; $link=$linkend='';
$lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">'; $link = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
$lienfin='</a>'; $linkend='</a>';
$name=$obj->name; $name=$obj->name;
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin); $result.=($link.img_object($langs->trans("ShowCompany").': '.$name,'company').$linkend);
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin; $result.=$link.(dol_trunc($name,$maxlen)).$linkend;
print $result; print $result;
print '</td>'; print '</td>';

View File

@ -368,7 +368,7 @@ if ($resql)
$nbprod++; // order contains real products $nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product; $generic_product->id = $generic_commande->lines[$lig]->fk_product;
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
$generic_product->load_stock(true); $generic_product->load_stock();
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
} else { } else {
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];

View File

@ -137,7 +137,7 @@ $head=bank_prepare_head($acct);
dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account');
$title=$langs->trans("FinancialAccount")." : ".$acct->label; $title=$langs->trans("FinancialAccount")." : ".$acct->label;
$lien=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":""); $link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -191,7 +191,7 @@ print '<br>';
// Affiche tableau // Affiche tableau
print '<table class="notopnoleftnoright" width="100%">'; print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$lien.'</td></tr>'; print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$link.'</td></tr>';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>'; print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)

View File

@ -39,12 +39,12 @@ class Account extends CommonObject
public $table_element='bank_account'; public $table_element='bank_account';
/** /**
* //TODO: Discuss this. $rowid is preferred over $id * @var int Use id instead of rowid
* @var
* @deprecated * @deprecated
*/ */
var $rowid; var $rowid;
var $id; var $id;
var $ref; var $ref;
var $label; var $label;
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne //! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
@ -968,9 +968,9 @@ class Account extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto Inclut le picto dans le lien * @param int $withpicto Include picto into link
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card * @param string $mode ''=Link to card, 'transactions'=Link to transactions card
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -988,17 +988,17 @@ class Account extends CommonObject
if (empty($mode)) if (empty($mode))
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose;
$lienfin='</a>'; $linkend='</a>';
} }
else if ($mode == 'transactions') else if ($mode == 'transactions')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$this->id.$linkclose;
$lienfin='</a>'; $linkend='</a>';
} }
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' '); if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$lien.$this->label.$lienfin; $result.=$link.$this->label.$linkend;
return $result; return $result;
} }
@ -1521,9 +1521,9 @@ class AccountLine extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen Longueur max libelle * @param int $maxlen Longueur max libelle
* @param string $option Option ('showall') * @param string $option Option ('showall')
* @return string Chaine avec URL * @return string Chaine avec URL
@ -1534,11 +1534,11 @@ class AccountLine extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowTransaction").': '.$this->rowid; $label=$langs->trans("ShowTransaction").': '.$this->rowid;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' '); if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$lien.$this->rowid.$lienfin; $result.=$link.$this->rowid.$linkend;
if ($option == 'showall' || $option == 'showconciliated') $result.=' ('; if ($option == 'showall' || $option == 'showconciliated') $result.=' (';
if ($option == 'showall') if ($option == 'showall')

View File

@ -841,8 +841,8 @@ if ($mode == 'standard')
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; } if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
// For month // For month
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>"; $link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
print '<tr><td align="right">'.$lien.'</td></tr>'; print '<tr><td align="right">'.$link.'</td></tr>';
print '<tr><td align="center">'; print '<tr><td align="center">';
$file = "movement".$account."-".$year.$month.".png"; $file = "movement".$account."-".$year.$month.".png";
@ -855,8 +855,8 @@ if ($mode == 'standard')
// For year // For year
$prevyear=$year-1;$nextyear=$year+1; $prevyear=$year-1;$nextyear=$year+1;
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>"; $link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next()."</a>";
print '<tr><td align="right">'.$lien.'</td></tr>'; print '<tr><td align="right">'.$link.'</td></tr>';
print '<tr><td align="center">'; print '<tr><td align="center">';
print $show5; print $show5;

View File

@ -349,7 +349,7 @@ class Deplacement extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
@ -359,15 +359,15 @@ class Deplacement extends CommonObject
$result=''; $result='';
$label=$langs->trans("Show").': '.$this->ref; $label=$langs->trans("Show").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='trip'; $picto='trip';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -703,7 +703,7 @@ class Don extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
@ -713,15 +713,15 @@ class Don extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowDonation").': '.$this->id; $label=$langs->trans("ShowDonation").': '.$this->id;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/dons/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/dons/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='generic'; $picto='generic';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->id.$lienfin; if ($withpicto != 2) $result.=$link.$this->id.$linkend;
return $result; return $result;
} }

View File

@ -2587,7 +2587,7 @@ if ($action == 'create')
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
$text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid); $text .= $notify->confirmMessage('BILL_VALIDATE', $object->socid, $object);
} }
$formquestion = array(); $formquestion = array();
@ -2749,8 +2749,9 @@ if ($action == 'create')
if (! $formconfirm) { if (! $formconfirm) {
$parameters = array('lineid' => $lineid); $parameters = array('lineid' => $lineid);
$formconfirm = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// hook if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
} }
// Print form confirm // Print form confirm

View File

@ -547,9 +547,9 @@ class FactureRec extends Facture
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'withdraw') * @param string $option Sur quoi pointe le lien ('', 'withdraw')
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -560,15 +560,15 @@ class FactureRec extends Facture
$result=''; $result='';
$label=$langs->trans("ShowInvoice").': '.$this->ref; $label=$langs->trans("ShowInvoice").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='bill'; $picto='bill';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -582,14 +582,14 @@ class Localtax extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowVatPayment").': '.$this->ref; $label=$langs->trans("ShowVatPayment").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/localtax/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='payment'; $picto='payment';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -768,9 +768,9 @@ class RemiseCheque extends CommonObject
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien * @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -781,12 +781,12 @@ class RemiseCheque extends CommonObject
$result=''; $result='';
$label = $langs->trans("ShowCheckReceipt").': '.$this->ref; $label = $langs->trans("ShowCheckReceipt").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/cheque/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -737,9 +737,9 @@ class Paiement extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien * @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -750,12 +750,12 @@ class Paiement extends CommonObject
$result=''; $result='';
$label = $langs->trans("ShowPayment").': '.$this->ref; $label = $langs->trans("ShowPayment").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -1113,17 +1113,17 @@ class BonPrelevement extends CommonObject
$result=''; $result='';
$label = $langs->trans("ShowWithdraw").': '.$this->ref; $label = $langs->trans("ShowWithdraw").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($option == 'xxx') if ($option == 'xxx')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
} }
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin.' '); if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
$result.=$lien.$this->ref.$lienfin; $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -156,7 +156,7 @@ class RejetPrelevement
} }
else else
{ {
$result=$pai->addPaymentToBank($user,'payment','(InvoiceRefused)',$bankaccount); $result=$pai->addPaymentToBank($user,'payment','(InvoiceRefused)',$bankaccount,'','');
if ($result < 0) if ($result < 0)
{ {
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");

View File

@ -490,14 +490,14 @@ class PaymentSalary extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowSalaryPayment").': '.$this->ref; $label=$langs->trans("ShowSalaryPayment").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='payment'; $picto='payment';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -77,8 +77,10 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
// Add social contribution // Add social contribution
if ($action == 'add' && $user->rights->tax->charges->creer) if ($action == 'add' && $user->rights->tax->charges->creer)
{ {
$dateech=@dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]); $dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=@dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]); $dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount');
$actioncode=GETPOST('actioncode');
if (! $dateech) if (! $dateech)
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
@ -89,12 +91,12 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors');
$action = 'create'; $action = 'create';
} }
elseif (! $_POST["actioncode"] > 0) elseif (! $actioncode > 0)
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors');
$action = 'create'; $action = 'create';
} }
elseif (! $_POST["amount"]) elseif (empty($amount))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
$action = 'create'; $action = 'create';
@ -103,11 +105,11 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{ {
$chargesociales=new ChargeSociales($db); $chargesociales=new ChargeSociales($db);
$chargesociales->type=$_POST["actioncode"]; $chargesociales->type=$actioncode;
$chargesociales->lib=$_POST["label"]; $chargesociales->lib=GETPOST('label');
$chargesociales->date_ech=$dateech; $chargesociales->date_ech=$dateech;
$chargesociales->periode=$dateperiod; $chargesociales->periode=$dateperiod;
$chargesociales->amount=$_POST["amount"]; $chargesociales->amount=price2num($amount);
$id=$chargesociales->create($user); $id=$chargesociales->create($user);
if ($id <= 0) if ($id <= 0)
@ -120,32 +122,39 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer) if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->creer)
{ {
$dateech=dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]); $dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=dol_mktime($_POST["periodhour"],$_POST["periodmin"],$_POST["periodsec"],$_POST["periodmonth"],$_POST["periodday"],$_POST["periodyear"]); $dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
if (! $dateech) $amount=GETPOST('amount');
{ if (! $dateech)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors'); {
$action = 'edit'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
} $action = 'edit';
elseif (! $dateperiod) }
{ elseif (! $dateperiod)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors'); {
$action = 'edit'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors');
} $action = 'edit';
}
elseif (empty($amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
$action = 'edit';
}
else else
{ {
$chargesociales=new ChargeSociales($db); $chargesociales=new ChargeSociales($db);
$result=$chargesociales->fetch($_GET["id"]); $result=$chargesociales->fetch($id);
$chargesociales->lib=$_POST["label"]; $chargesociales->lib=GETPOST('label');
$chargesociales->date_ech=$dateech; $chargesociales->date_ech=$dateech;
$chargesociales->periode=$dateperiod; $chargesociales->periode=$dateperiod;
$chargesociales->amount=price2num($amount);
$result=$chargesociales->update($user); $result=$chargesociales->update($user);
if ($result <= 0) if ($result <= 0)
{ {
setEventMessage($chargesociales->error, 'errors'); setEventMessage($chargesociales->error, 'errors');
} }
} }
} }
@ -437,7 +446,15 @@ if ($id > 0)
} }
// Amount // Amount
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>'; if ($action == 'edit')
{
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td>";
print '<input type="text" name="amount" size="12" class="flat" value="'.$object->amount.'">';
print "</td></tr>";
}
else {
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
}
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
@ -466,7 +483,7 @@ if ($id > 0)
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
// Edit // Edit
if ($user->rights->tax->charges->creer) if ($object->paye == 0 && $user->rights->tax->charges->creer)
{ {
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&amp;action=edit\">".$langs->trans("Modify")."</a>"; print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&amp;action=edit\">".$langs->trans("Modify")."</a>";
} }
@ -500,7 +517,7 @@ if ($id > 0)
} }
else else
{ {
/* Charge non trouv<75> */ /* Social contribution not found */
dol_print_error('',$object->error); dol_print_error('',$object->error);
} }
} }

View File

@ -266,7 +266,8 @@ class ChargeSociales extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
$sql.= " SET libelle='".$this->db->escape($this->lib)."',"; $sql.= " SET libelle='".$this->db->escape($this->lib)."',";
$sql.= " date_ech='".$this->db->idate($this->date_ech)."',"; $sql.= " date_ech='".$this->db->idate($this->date_ech)."',";
$sql.= " periode='".$this->db->idate($this->periode)."'"; $sql.= " periode='".$this->db->idate($this->periode)."',";
$sql.= " amount='".price2num($this->amount,'MT')."'";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -407,9 +408,9 @@ class ChargeSociales extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen Longueur max libelle * @param int $maxlen Longueur max libelle
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -422,12 +423,12 @@ class ChargeSociales extends CommonObject
if (empty($this->ref)) $this->ref=$this->lib; if (empty($this->ref)) $this->ref=$this->lib;
$label = $langs->trans("ShowSocialContribution").': '.$this->ref; $label = $langs->trans("ShowSocialContribution").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'bill', 'class="classfortooltip"').$lienfin.' '); if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' ');
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin; if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
return $result; return $result;
} }

View File

@ -576,9 +576,9 @@ class PaymentSocialContribution extends CommonObject
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen Longueur max libelle * @param int $maxlen Longueur max libelle
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -593,12 +593,12 @@ class PaymentSocialContribution extends CommonObject
if (!empty($this->id)) if (!empty($this->id))
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin.' '); if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$lienfin; if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
} }
return $result; return $result;

View File

@ -640,14 +640,14 @@ class Tva extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowVatPayment").': '.$this->ref; $label=$langs->trans("ShowVatPayment").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='payment'; $picto='payment';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -895,17 +895,17 @@ class Contact extends CommonObject
$label = '<u>' . $langs->trans("ShowContact") . '</u>'; $label = '<u>' . $langs->trans("ShowContact") . '</u>';
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs); $label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
if ($option == 'xxx') if ($option == 'xxx')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
} }
if ($withpicto) $result.=($lien.img_object($label, 'contact', 'class="classfortooltip"').$lienfin.' '); if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
$result.=$lien.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$lienfin; $result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
return $result; return $result;
} }

View File

@ -1053,7 +1053,7 @@ if ($action == 'create')
print "</table>\n"; print "</table>\n";
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>'; print '<br><div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
if (is_object($objectsrc)) if (is_object($objectsrc))
{ {

View File

@ -89,23 +89,7 @@ class Contrat extends CommonObject
var $product; var $product;
/** /**
* TODO: Which is the correct one? * @var int Id of user author of the contract
* Author of the contract
* @var
*/
var $user_author;
/**
* TODO: Which is the correct one?
* Author of the contract
* @var User
*/
public $user_creation;
/**
* TODO: Which is the correct one?
* Author of the contract
* @var int
*/ */
public $fk_user_author; public $fk_user_author;
@ -117,38 +101,37 @@ class Contrat extends CommonObject
public $user_author_id; public $user_author_id;
/** /**
* @var User * @var User Object user that create the contract. Set by the info method.
*/
public $user_creation;
/**
* @var User Object user that close the contract. Set by the info method.
*/ */
public $user_cloture; public $user_cloture;
/** /**
* Date of creation * @var int Date of creation
* @var int
*/ */
var $date_creation; var $date_creation;
/** /**
* Date of last modification * @var int Date of last modification. Not filled until you call ->info()
* Not filled until you call ->info()
* @var int
*/ */
public $date_modification; public $date_modification;
/** /**
* Date of validation * @var int Date of validation
* @var int
*/ */
var $date_validation; var $date_validation;
/** /**
* Date when contract was signed * @var int Date when contract was signed
* @var int
*/ */
var $date_contrat; var $date_contrat;
/** /**
* Date of contract closure * @var int Date of contract closure
* @var int
* @deprecated we close contract lines, not a contract * @deprecated we close contract lines, not a contract
*/ */
var $date_cloture; var $date_cloture;
@ -157,21 +140,15 @@ class Contrat extends CommonObject
var $commercial_suivi_id; var $commercial_suivi_id;
/** /**
* @deprecated Use note_private or note_public instead * @var string Private note
*/
var $note;
/**
* Private note
* @var string
*/ */
var $note_private; var $note_private;
/** /**
* Public note * @var string Public note
* @var string
*/ */
var $note_public; var $note_public;
var $modelpdf; var $modelpdf;
/** /**
@ -184,8 +161,7 @@ class Contrat extends CommonObject
var $extraparams=array(); var $extraparams=array();
/** /**
* Contract lines * @var ContratLigne[] Contract lines
* @var ContratLigne[]
*/ */
var $lines=array(); var $lines=array();
@ -569,7 +545,6 @@ class Contrat extends CommonObject
$this->commercial_signature_id = $result["fk_commercial_signature"]; $this->commercial_signature_id = $result["fk_commercial_signature"];
$this->commercial_suivi_id = $result["fk_commercial_suivi"]; $this->commercial_suivi_id = $result["fk_commercial_suivi"];
$this->note = $result["note_private"]; // deprecated
$this->note_private = $result["note_private"]; $this->note_private = $result["note_private"];
$this->note_public = $result["note_public"]; $this->note_public = $result["note_public"];
$this->modelpdf = $result["model_pdf"]; $this->modelpdf = $result["model_pdf"];
@ -1742,9 +1717,9 @@ class Contrat extends CommonObject
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max length of ref * @param int $maxlength Max length of ref
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -1755,15 +1730,15 @@ class Contrat extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowContract").': '.$this->ref; $label=$langs->trans("ShowContract").': '.$this->ref;
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='contract'; $picto='contract';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$lienfin; if ($withpicto != 2) $result.=$link.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$linkend;
return $result; return $result;
} }
@ -2290,9 +2265,9 @@ class ContratLigne extends CommonObject
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max length * @param int $maxlength Max length
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
@ -2303,15 +2278,15 @@ class ContratLigne extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowContractOfService").': '.$this->label; $label=$langs->trans("ShowContractOfService").': '.$this->label;
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$picto='contract'; $picto='contract';
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$lien.$this->label.$lienfin; if ($withpicto != 2) $result.=$link.$this->label.$linkend;
return $result; return $result;
} }

View File

@ -80,6 +80,13 @@ if ($action == 'add')
$mesg[]=$langs->trans("ErrorNoValueForCheckBoxType"); $mesg[]=$langs->trans("ErrorNoValueForCheckBoxType");
$action = 'create'; $action = 'create';
} }
if (GETPOST('type')=='link' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForLinkType");
$action = 'create';
}
if (GETPOST('type')=='radio' && !GETPOST('param')) if (GETPOST('type')=='radio' && !GETPOST('param'))
{ {
$error++; $error++;

View File

@ -342,7 +342,8 @@ class box_activity extends ModeleBoxes
} }
// list the summary of the propals // list the summary of the propals
if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic=new Propal($db); $propalstatic=new Propal($db);
@ -350,7 +351,8 @@ class box_activity extends ModeleBoxes
$filename = '/boxactivity-propal'.$fileid; $filename = '/boxactivity-propal'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $data = array();
if ($refresh) { if ($refresh)
{
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb"; $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -365,8 +367,8 @@ class box_activity extends ModeleBoxes
$sql.= " ORDER BY p.fk_statut DESC"; $sql.= " ORDER BY p.fk_statut DESC";
$result = $db->query($sql); $result = $db->query($sql);
if ($result)
if ($result) { {
$num = $db->num_rows($result) + $line; $num = $db->num_rows($result) + $line;
$j=0; $j=0;
while ($j < $num) { while ($j < $num) {
@ -380,12 +382,17 @@ class box_activity extends ModeleBoxes
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} else { }
else
{
$data = dol_readcachefile($cachedir, $filename); $data = dol_readcachefile($cachedir, $filename);
} }
if (! empty($data)) {
if (! empty($data))
{
$j=0; $j=0;
while ($line < count($data)) { while ($line < count($data))
{
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"', 'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&amp;leftmenu=propals&amp;viewstatut=".$data[$j]->fk_statut, 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&amp;leftmenu=propals&amp;viewstatut=".$data[$j]->fk_statut,
@ -393,7 +400,6 @@ class box_activity extends ModeleBoxes
'logo' => 'object_propal' 'logo' => 'object_propal'
); );
$objp = $db->fetch_object($result);
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'align="left"', 'td' => 'align="left"',
'text' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0), 'text' => $langs->trans("Proposals")."&nbsp;".$propalstatic->LibStatut($data[$j]->fk_statut,0),

View File

@ -62,7 +62,7 @@ class box_contacts extends ModeleBoxes
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc"; $sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc";
$sql.= ", s.nom as socname"; $sql.= ", s.nom as socname";
$sql.= ", s.code_client"; $sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
@ -87,7 +87,8 @@ class box_contacts extends ModeleBoxes
$datec=$db->jdate($objp->datec); $datec=$db->jdate($objp->datec);
$datem=$db->jdate($objp->tms); $datem=$db->jdate($objp->tms);
$contactstatic->lastname=$objp->lastname; $contactstatic->id=$objp->id;
$contactstatic->lastname=$objp->lastname;
$contactstatic->firstname=$objp->firstname; $contactstatic->firstname=$objp->firstname;
$contactstatic->civility_id=$objp->civility_id; $contactstatic->civility_id=$objp->civility_id;

View File

@ -85,8 +85,8 @@ class CMailFile
* CMailFile * CMailFile
* *
* @param string $subject Topic/Subject of mail * @param string $subject Topic/Subject of mail
* @param string $to Recipients emails (RFC 2822: "Nom firstname <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param string $to Recipients emails (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]"). Note: the keyword '__SUPERVISOREMAIL__' is not allowed here and must be replaced by caller.
* @param string $from Sender email (RFC 2822: "Nom firstname <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param string $from Sender email (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]")
* @param string $msg Message * @param string $msg Message
* @param array $filename_list List of files to attach (full path of filename on file system) * @param array $filename_list List of files to attach (full path of filename on file system)
* @param array $mimetype_list List of MIME type of attached files * @param array $mimetype_list List of MIME type of attached files
@ -98,9 +98,7 @@ class CMailFile
* @param string $errors_to Email errors * @param string $errors_to Email errors
* @param string $css Css option * @param string $css Css option
*/ */
function __construct($subject,$to,$from,$msg, function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='')
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='')
{ {
global $conf; global $conf;
@ -1023,9 +1021,9 @@ class CMailFile
} }
/** /**
* Return an address for SMTP protocol * Return a formatted address string for SMTP protocol
* *
* @param string $address Example: 'John Doe <john@doe.com>' or 'john@doe.com' * @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
* @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between " * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
* @param int $encode 1=Encode name to RFC2822 * @param int $encode 1=Encode name to RFC2822
* @return string If format 0: '<john@doe.com>' or 'John Doe <john@doe.com>' or '=?UTF-8?B?Sm9obiBEb2U=?= <john@doe.com>' * @return string If format 0: '<john@doe.com>' or 'John Doe <john@doe.com>' or '=?UTF-8?B?Sm9obiBEb2U=?= <john@doe.com>'

View File

@ -35,46 +35,69 @@
*/ */
abstract class CommonObject abstract class CommonObject
{ {
public $db; /**
* @var DoliDb Database handler (result of a new DoliDB)
*/
public $db;
/** /**
* @var error Error string * @var string Error string
* @deprecated Use instead the array of error strings * @deprecated Use instead the array of error strings
*/ */
public $error; public $error;
/** /**
* @var errors Aray of error string * @var string[] Array of error strings
*/ */
public $errors; public $errors;
public $canvas; // Contains canvas name if it is /**
public $context=array(); // Use to pass context information * @var string Can be used to pass information when only object is provied to method
*/
public $context=array();
/**
* @var string Contains canvas name if record is an alternative canvas record
*/
public $canvas;
/**
* @var string Key value used to track if data is coming from import wizard
*/
public $import_key;
/**
* @var mixed Contains data to manage extrafields
*/
public $array_options=array();
/**
* @var int[] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/
public $linkedObjectsIds;
/**
* @var mixed Array of linked objects. Loaded by ->fetchObjectLinked
*/
public $linkedObjects;
/**
* @var string Column name of the ref field.
*/
protected $table_ref_field = '';
// Following var are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.
public $name; public $name;
public $lastname; public $lastname;
public $firstname; public $firstname;
public $civility_id; public $civility_id;
public $import_key;
public $array_options=array();
/**
* @var Societe
*/
public $thirdparty; public $thirdparty;
public $linkedObjectsIds; // Loaded by ->fetchObjectLinked
public $linkedObjects; // Loaded by ->fetchObjectLinked
// No constructor as it is an abstract class // No constructor as it is an abstract class
/**
* Column name of the ref field.
* @var string
*/
protected $table_ref_field = '';
/** /**
* Check an object id/ref exists * Check an object id/ref exists
@ -2804,12 +2827,7 @@ abstract class CommonObject
if ($line->fk_product > 0) if ($line->fk_product > 0)
{ {
$product_static = new Product($this->db); $product_static = new Product($this->db);
$product_static->fetch($line->fk_product);
$product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product;
$product_static->ref=$line->ref;
if (! empty($line->entity))
$product_static->entity=$line->entity;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
// Define output language and label // Define output language and label
@ -2842,7 +2860,7 @@ abstract class CommonObject
} }
$text.= ' - '.(! empty($line->label)?$line->label:$label); $text.= ' - '.(! empty($line->label)?$line->label:$label);
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); $description.=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
} }
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
@ -3463,6 +3481,31 @@ abstract class CommonObject
} }
} }
/**
* Build thumb
*
* @param string $file Path file in UTF8 to original file to create thumbs from.
* @return void
*/
function add_thumb($file)
{
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
$file_osencoded=dol_osencode($file);
if (file_exists($file_osencoded))
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($file_osencoded, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($file_osencoded, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
/* Functions common to commonobject and commonobjectline */ /* Functions common to commonobject and commonobjectline */
@ -3629,6 +3672,7 @@ abstract class CommonObject
$attributeType = $extrafields->attribute_type[$attributeKey]; $attributeType = $extrafields->attribute_type[$attributeKey];
$attributeSize = $extrafields->attribute_size[$attributeKey]; $attributeSize = $extrafields->attribute_size[$attributeKey];
$attributeLabel = $extrafields->attribute_label[$attributeKey]; $attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey];
switch ($attributeType) switch ($attributeType)
{ {
case 'int': case 'int':
@ -3651,6 +3695,19 @@ abstract class CommonObject
case 'datetime': case 'datetime':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]); $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break; break;
case 'link':
$param_list=array_keys($attributeParam ['options']);
// 0 : ObjectName
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$object->fetch(0,$value);
$this->array_options[$key]=$object->id;
}
break;
} }
} }
$this->db->begin(); $this->db->begin();

View File

@ -435,23 +435,23 @@ class DiscountAbsolute
if ($option == 'invoice') { if ($option == 'invoice') {
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; $label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
$lien = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$this->fk_facture_source.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$ref=$this->ref_facture_source; $ref=$this->ref_facture_source;
$picto='bill'; $picto='bill';
} }
if ($option == 'discount') { if ($option == 'discount') {
$label=$langs->trans("Discount"); $label=$langs->trans("Discount");
$lien = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->fk_soc.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lienfin='</a>'; $linkend='</a>';
$ref=$langs->trans("Discount"); $ref=$langs->trans("Discount");
$picto='generic'; $picto='generic';
} }
if ($withpicto) $result.=($lien.img_object($label, $picto, 'class="classfortooltip"').$lienfin); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$lien.$ref.$lienfin; $result.=$link.$ref.$linkend;
return $result; return $result;
} }

View File

@ -65,7 +65,7 @@ class DolGraph
var $bgcolorgrid=array(255,255,255); // array(R,G,B) var $bgcolorgrid=array(255,255,255); // array(R,G,B)
var $datacolor; // array(array(R,G,B),...) var $datacolor; // array(array(R,G,B),...)
protected $stringtoshow; // To store string to output graph into HTML page private $_stringtoshow; // To store string to output graph into HTML page
/** /**

View File

@ -6,6 +6,7 @@
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <forian.henry@open-concept.pro>
* Copyright (C) 2015 Charles-Fr BENKE <charles.fr@benke.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -77,6 +78,7 @@ class ExtraFields
'checkbox' => 'ExtrafieldCheckBox', 'checkbox' => 'ExtrafieldCheckBox',
'radio' => 'ExtrafieldRadio', 'radio' => 'ExtrafieldRadio',
'chkbxlst' => 'ExtrafieldCheckBoxFromList', 'chkbxlst' => 'ExtrafieldCheckBoxFromList',
'link' => 'ExtrafieldLink',
); );
/** /**
@ -187,6 +189,9 @@ class ExtraFields
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){ } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){
$typedb='text'; $typedb='text';
$lengthdb=''; $lengthdb='';
} elseif ($type=='link') {
$typedb='int';
$lengthdb='11';
} else { } else {
$typedb=$type; $typedb=$type;
$lengthdb=$length; $lengthdb=$length;
@ -404,6 +409,9 @@ class ExtraFields
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) { } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) {
$typedb='text'; $typedb='text';
$lengthdb=''; $lengthdb='';
} elseif ($type=='link') {
$typedb='int';
$lengthdb='11';
} else { } else {
$typedb=$type; $typedb=$type;
$lengthdb=$length; $lengthdb=$length;
@ -522,7 +530,7 @@ class ExtraFields
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").","; $sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
$sql.= " '".$pos."',"; $sql.= " '".$pos."',";
$sql.= " '".$alwayseditable."',"; $sql.= " '".$alwayseditable."',";
$sql.= " '".$param."'"; $sql.= " '".$param."',";
$sql.= " ".$list; $sql.= " ".$list;
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::update_label", LOG_DEBUG); dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
@ -596,7 +604,7 @@ class ExtraFields
$this->attribute_pos[$tab->name]=$tab->pos; $this->attribute_pos[$tab->name]=$tab->pos;
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable; $this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
$this->attribute_perms[$tab->name]=$tab->perms; $this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_perms[$tab->name]=$tab->list; $this->attribute_list[$tab->name]=$tab->list;
} }
} }
} }
@ -1043,6 +1051,19 @@ class ExtraFields
} }
$out .= '</select>'; $out .= '</select>';
} }
elseif ($type == 'link')
{
$out='';
$param_list=array_keys($param['options']);
// 0 : ObjectName
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
}
/* Add comments /* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)'; if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
@ -1268,6 +1289,21 @@ class ExtraFields
} else } else
dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING); dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING);
} }
elseif ($type == 'link')
{
$out='';
$param_list=array_keys($params['options']);
// 0 : ObjectName
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$object->fetch($value);
$value=$object->getNomUrl(3);
}
}
else else
{ {
$showsize=round($size); $showsize=round($size);

View File

@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/** /**
* Class to manage fiscal year * Class to manage fiscal year
*/ */
class Fiscalyear class Fiscalyear extends CommonObject
{ {
public $element='fiscalyear'; public $element='fiscalyear';
public $table_element='accounting_fiscalyear'; public $table_element='accounting_fiscalyear';

View File

@ -128,10 +128,8 @@ class HookManager
$parameters['context']=join(':',$this->contextarray); $parameters['context']=join(':',$this->contextarray);
dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
// Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated. // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated).
$hooktype='output'; $hooktype='output';
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
if ($method =='insertExtraFields') $hooktype='returnvalue';
if (in_array( if (in_array(
$method, $method,
array( array(
@ -149,6 +147,13 @@ class HookManager
'formatEvent' 'formatEvent'
) )
)) $hooktype='addreplace'; )) $hooktype='addreplace';
// Deprecated hook types
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.
dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
}
// Loop on each hook to qualify modules that have declared context // Loop on each hook to qualify modules that have declared context
$modulealreadyexecuted=array(); $modulealreadyexecuted=array();
@ -201,8 +206,6 @@ class HookManager
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
// TODO dead code to remove (do not enable this, but fix hook instead)
//if (is_array($result)) $this->resArray = array_merge($this->resArray, $result);
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string
if (! is_array($result) && ! is_numeric($result)) if (! is_array($result) && ! is_numeric($result))
{ {
@ -221,8 +224,8 @@ class HookManager
} }
// TODO remove this. When there is something to print for an output hook, ->resPrint is filled. // TODO remove this. When there is something to print for an output hook, ->resPrint is filled.
if ($hooktype == 'output') return $this->resPrint; //if ($hooktype == 'output') return $this->resPrint;
if ($hooktype == 'returnvalue') return $result; //if ($hooktype == 'returnvalue') return $result;
return ($error?-1:$resaction); return ($error?-1:$resaction);
} }

View File

@ -395,12 +395,13 @@ class Form
$htmltext=str_replace("\n","",$htmltext); $htmltext=str_replace("\n","",$htmltext);
$htmltext=str_replace('"',"&quot;",$htmltext); $htmltext=str_replace('"',"&quot;",$htmltext);
if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip
else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
$s=""; $s="";
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>'; if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
elseif ($notabs == 2) $s.='<div class="inline-block nowrap">';
if ($direction < 0) { if ($direction < 0) {
$s.='<'.$tag.$paramfortooltipimg; $s.='<'.$tag.$paramfortooltipimg;
if ($tag == 'td') { if ($tag == 'td') {
@ -411,8 +412,8 @@ class Form
// Use another method to help avoid having a space in value in order to use this value with jquery // Use another method to help avoid having a space in value in order to use this value with jquery
// TODO add this in css // TODO add this in css
//if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?'&nbsp;':'').$text.(($direction > 0)?'&nbsp;':'').'</'.$tag.'>'; //if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?'&nbsp;':'').$text.(($direction > 0)?'&nbsp;':'').'</'.$tag.'>';
$paramfortooltiptd.= (($direction < 0)?' style="padding-left: 3px !important;"':''); $paramfortooltiptd.= (($direction < 0)?' class="inline-block" style="padding-left: 3px !important;"':'');
$paramfortooltiptd.= (($direction > 0)?' style="padding-right: 3px !important;"':''); $paramfortooltiptd.= (($direction > 0)?' class="inline-block" style="padding-right: 3px !important;"':'');
if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
if ($direction > 0) { if ($direction > 0) {
$s.='<'.$tag.$paramfortooltipimg; $s.='<'.$tag.$paramfortooltipimg;
@ -422,6 +423,7 @@ class Form
$s.= '>'.$img.'</'.$tag.'>'; $s.= '>'.$img.'</'.$tag.'>';
} }
if (empty($notabs)) $s.='</tr></table>'; if (empty($notabs)) $s.='</tr></table>';
elseif ($notabs == 2) $s.='</div>';
return $s; return $s;
} }
@ -1641,7 +1643,7 @@ class Form
if ($result) if ($result)
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; $out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
@ -2022,7 +2024,7 @@ class Form
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
@ -2191,7 +2193,7 @@ class Form
} }
else else
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
$form.= '<option value="0">&nbsp;</option>'; $form.= '<option value="0">&nbsp;</option>';
$i = 0; $i = 0;
@ -4445,7 +4447,7 @@ class Form
} }
else else
{ {
$selected=($useempty?'':' selected="selected"'); $selected=(($useempty && $value != '0' && $value != 'no')?'':' selected="selected"');
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n"; $resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n"; $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
} }

View File

@ -550,7 +550,11 @@ class FormFile
// Execute hooks // Execute hooks
$parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart); $parameters=array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''),'modulepart'=>$modulepart);
if (is_object($hookmanager)) $out.= $hookmanager->executeHooks('formBuilddocOptions',$parameters,$GLOBALS['object']); if (is_object($hookmanager))
{
$reshook = $hookmanager->executeHooks('formBuilddocOptions',$parameters,$GLOBALS['object']);
$out.= $hookmanager->resPrint;
}
} }
// Get list of files // Get list of files

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -25,11 +25,12 @@
*/ */
/** /**
* \class Ldap * Class to manage LDAP features
* \brief Class to manage LDAP features
*/ */
class Ldap class Ldap
{ {
var $error;
/** /**
* Tableau des serveurs (IP addresses ou nom d'hotes) * Tableau des serveurs (IP addresses ou nom d'hotes)
*/ */
@ -78,7 +79,7 @@ class Ldap
var $name; var $name;
var $firstname; var $firstname;
var $login; var $login;
var $phone; var $phone;
var $skype; var $skype;
var $fax; var $fax;
var $mail; var $mail;
@ -414,9 +415,10 @@ class Ldap
} }
else else
{ {
$this->error=@ldap_error($this->connection); $this->ldapErrorCode = @ldap_errno($this->connection);
$this->errno=@ldap_errno($this->connection); $this->ldapErrorText = @ldap_error($this->connection);
dol_syslog(get_class($this)."::add failed: ".$this->errno." ".$this->error, LOG_ERR); $this->error=$this->ldapErrorCode." ".$this->ldapErrorText;
dol_syslog(get_class($this)."::add failed: ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@ -61,14 +61,15 @@ class Notify
* *
* @param string $action Id of action in llx_c_action_trigger * @param string $action Id of action in llx_c_action_trigger
* @param int $socid Id of third party * @param int $socid Id of third party
* @param Object $object Object the notification is about
* @return string Message * @return string Message
*/ */
function confirmMessage($action,$socid) function confirmMessage($action,$socid,$object)
{ {
global $langs; global $langs;
$langs->load("mails"); $langs->load("mails");
$nb=$this->countDefinedNotifications($action,$socid); $nb=$this->countDefinedNotifications($action,$socid,$object);
if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent"); if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent"); if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb); if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
@ -76,22 +77,25 @@ class Notify
} }
/** /**
* Return number of notifications activated for action code and third party * Return number of notifications activated for action code (and third party)
* *
* @param string $action Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage) * @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
* @param int $socid Id of third party * @param int $socid Id of third party or 0 for all thirdparties
* @return int <0 if KO, nb of notifications sent if OK * @param Object $object Object the notification is about
* @return int <0 if KO, nb of notifications sent if OK
*/ */
function countDefinedNotifications($action,$socid) function countDefinedNotifications($notifcode,$socid,$object=null)
{ {
global $conf; global $conf;
$error=0; $error=0;
$num=0; $num=0;
$valueforthreshold = $object->total_ht;
if (! $error) if (! $error)
{ {
$sql = "SELECT n.rowid"; $sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,"; $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
@ -99,22 +103,23 @@ class Notify
$sql.= " WHERE n.fk_contact = c.rowid"; $sql.= " WHERE n.fk_contact = c.rowid";
$sql.= " AND a.rowid = n.fk_action"; $sql.= " AND a.rowid = n.fk_action";
$sql.= " AND n.fk_soc = s.rowid"; $sql.= " AND n.fk_soc = s.rowid";
if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
else $sql.= " AND a.code = '".$action."'"; // New usage else $sql.= " AND a.code = '".$notifcode."'"; // New usage
$sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND s.rowid = ".$socid; if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
dol_syslog(get_class($this)."::countDefinedNotifications ".$action.", ".$socid."", LOG_DEBUG); dol_syslog(get_class($this)."::countDefinedNotifications ".$notifcode.", ".$socid."", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $obj = $this->db->fetch_object($resql);
if ($obj) $num = $obj->nb;
} }
else else
{ {
$error++; $error++;
$this->error=$this->db->error.' sql='.$sql; $this->error=$this->db->lasterror();
} }
} }
@ -123,12 +128,19 @@ class Notify
// List of notifications enabled for fixed email // List of notifications enabled for fixed email
foreach($conf->global as $key => $val) foreach($conf->global as $key => $val)
{ {
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$action.'/', $key, $reg)) continue; if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
$num++;
$threshold = (float) $reg[1];
if ($valueforthreshold <= $threshold)
{
continue;
}
$tmpemail=explode(',',$val);
$num+=count($tmpemail);
} }
} }
// TODO return array with list of email instead of number, + type of notification (contacts or fixed email)
if ($error) return -1; if ($error) return -1;
return $num; return $num;
} }
@ -137,17 +149,17 @@ class Notify
* Check if notification are active for couple action/company. * Check if notification are active for couple action/company.
* If yes, send mail and save trace into llx_notify. * If yes, send mail and save trace into llx_notify.
* *
* @param string $action Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage) * @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
* @param Object $object Object the notification deals on * @param Object $object Object the notification deals on
* @return int <0 if KO, or number of changes if OK * @return int <0 if KO, or number of changes if OK
*/ */
function send($action, $object) function send($notifcode, $object)
{ {
global $conf,$langs,$mysoc,$dolibarr_main_url_root; global $user,$conf,$langs,$mysoc,$dolibarr_main_url_root;
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_syslog(get_class($this)."::send action=".$action.", object=".$object->id); dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id);
$langs->load("other"); $langs->load("other");
@ -166,7 +178,20 @@ class Notify
$link = ''; $link = '';
$num = 0; $num = 0;
if (! in_array($action, array('BILL_VALIDATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'FICHINTER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', 'SHIPPING_VALIDATE'))) if (! in_array(
$notifcode,
array(
'BILL_VALIDATE',
'ORDER_VALIDATE',
'PROPAL_VALIDATE',
'FICHINTER_VALIDATE',
'ORDER_SUPPLIER_VALIDATE',
'ORDER_SUPPLIER_APPROVE',
'ORDER_SUPPLIER_REFUSE',
'SHIPPING_VALIDATE'
)
)
)
{ {
return 0; return 0;
} }
@ -181,8 +206,8 @@ class Notify
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
$sql.= " AND n.fk_soc = s.rowid"; $sql.= " AND n.fk_soc = s.rowid";
if (is_numeric($action)) $sql.= " AND n.fk_action = ".$action; // Old usage if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
else $sql.= " AND a.code = '".$action."'"; // New usage else $sql.= " AND a.code = '".$notifcode."'"; // New usage
$sql .= " AND s.rowid = ".$object->socid; $sql .= " AND s.rowid = ".$object->socid;
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -197,8 +222,8 @@ class Notify
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">"; $sendto = dolGetFirstLastname($obj->firstname,$obj->lastname) . " <".$obj->email.">";
$actiondefid = $obj->adid; $notifcodedefid = $obj->adid;
if (dol_strlen($obj->email)) if (dol_strlen($obj->email))
{ {
@ -210,7 +235,7 @@ class Notify
$outputlangs->setDefaultLang($obj->default_lang); $outputlangs->setDefaultLang($obj->default_lang);
} }
switch ($action) { switch ($notifcode) {
case 'BILL_VALIDATE': case 'BILL_VALIDATE':
$link='/compta/facture.php?facid='.$object->id; $link='/compta/facture.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
@ -235,6 +260,14 @@ class Notify
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
break; break;
case 'ORDER_SUPPLIER_VALIDATE':
$link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
@ -294,7 +327,7 @@ class Notify
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')"; $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')";
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
dol_print_error($this->db); dol_print_error($this->db);
@ -328,113 +361,150 @@ class Notify
// Check notification using fixed email // Check notification using fixed email
if (! $error) if (! $error)
{ {
$param='NOTIFICATION_FIXEDEMAIL_'.$action; foreach($conf->global as $key => $val)
if (! empty($conf->global->$param)) {
{ if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
$sendto = $conf->global->$param;
$actiondefid = dol_getIdFromCode($this->db, $action, 'c_action_trigger', 'code', 'rowid');
if ($actiondefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
$object_type = ''; $threshold = (float) $reg[1];
if ($object->total_ht <= $threshold)
{
dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
continue;
}
$param='NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
$sendto = $conf->global->$param;
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
if ($notifcodedefid <= 0) dol_print_error($this->db, 'Failed to get id from code');
$object_type = '';
$link = ''; $link = '';
$num++; $num++;
switch ($action) { switch ($notifcode) {
case 'BILL_VALIDATE': case 'BILL_VALIDATE':
$link='/compta/facture.php?facid='.$object->id; $link='/compta/facture.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'facture'; $object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref);
break; break;
case 'ORDER_VALIDATE': case 'ORDER_VALIDATE':
$link='/commande/card.php?id='.$object->id; $link='/commande/card.php?id='.$object->id;
$dir_output = $conf->commande->dir_output; $dir_output = $conf->commande->dir_output;
$object_type = 'order'; $object_type = 'order';
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref);
break; break;
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
$link='/comm/propal.php?id='.$object->id; $link='/comm/propal.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->dir_output;
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref);
break; break;
case 'FICHINTER_VALIDATE': case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
break; break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_VALIDATE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'ORDER_SUPPLIER_REFUSE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'SHIPPING_VALIDATE': case 'ORDER_SUPPLIER_REFUSE':
$dir_output = $conf->expedition->dir_output.'/sending/'; $link='/fourn/commande/card.php?id='.$object->id;
$object_type = 'order_supplier'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); $object_type = 'order_supplier';
break; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
} $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs));
$ref = dol_sanitizeFileName($object->ref); $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; break;
if (! dol_is_file($pdf_path)) case 'SHIPPING_VALIDATE':
{ $dir_output = $conf->expedition->dir_output.'/sending/';
// We can't add PDF as it is not generated yet. $object_type = 'order_supplier';
$filepdf = ''; $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref);
} break;
else }
{ $ref = dol_sanitizeFileName($object->ref);
$filepdf = $pdf_path; $pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
} if (! dol_is_file($pdf_path))
{
// We can't add PDF as it is not generated yet.
$filepdf = '';
}
else
{
$filepdf = $pdf_path;
}
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification"); $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n"; $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
$message.= "\n"; $message.= "\n";
$message.= $mesg; $message.= $mesg;
if ($link) $message=dol_concatdesc($message,$urlwithroot.$link); if ($link) $message=dol_concatdesc($message,$urlwithroot.$link);
$mailfile = new CMailFile( // Replace keyword __SUPERVISOREMAIL__
$subject, if (preg_match('/__SUPERVISOREMAIL__/', $sendto))
$sendto, {
$replyto, $newval='';
$message, if ($user->fk_user > 0)
array($file), {
array($mimefile), $supervisoruser=new User($this->db);
array($filename[count($filename)-1]), $supervisoruser->fetch($user->fk_user);
'', if ($supervisoruser->email) $newval=trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
'', }
0, dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
-1 $sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
); $sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
}
if ($mailfile->sendfile()) if ($sendto)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)"; $mailfile = new CMailFile(
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')"; $subject,
if (! $this->db->query($sql)) $sendto,
{ $replyto,
dol_print_error($this->db); $message,
} array($file),
} array($mimefile),
else array($filename[count($filename)-1]),
{ '',
$error++; '',
$this->errors[]=$mailfile->error; 0,
} -1
} );
if ($mailfile->sendfile())
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".$object->socid.", null, 'email', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
if (! $this->db->query($sql))
{
dol_print_error($this->db);
}
}
else
{
$error++;
$this->errors[]=$mailfile->error;
}
}
}
} }
if (! $error) return $num; if (! $error) return $num;

View File

@ -315,7 +315,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $login login * @param string $login login
* @param string $passwd password * @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql) * @param string $name name of database (not used for mysql, used for pgsql)
* @param string $port Port of database server * @param integer $port Port of database server
* @return resource Database access handler * @return resource Database access handler
* @see close * @see close
*/ */
@ -530,7 +530,7 @@ class DoliDBSqlite3 extends DoliDB
/** /**
* Return datas as an array * Return datas as an array
* *
* @param Resultset $resultset Resultset of request * @param resource $resultset Resultset of request
* @return array Array * @return array Array
*/ */
function fetch_row($resultset) function fetch_row($resultset)
@ -588,7 +588,7 @@ class DoliDBSqlite3 extends DoliDB
/** /**
* Free last resultset used. * Free last resultset used.
* *
* @param resultset $resultset Curseur de la requete voulue * @param integer $resultset Curseur de la requete voulue
* @return void * @return void
*/ */
function free($resultset=0) function free($resultset=0)
@ -709,7 +709,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @param string $fieldorvalue Field name or value to encrypt * @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes * @param int $withQuotes Return string with quotes
* @return return XXX(field) or XXX('value') or field or 'value' * @return string XXX(field) or XXX('value') or field or 'value'
*/ */
function encrypt($fieldorvalue, $withQuotes=0) function encrypt($fieldorvalue, $withQuotes=0)
{ {
@ -1255,11 +1255,14 @@ class DoliDBSqlite3 extends DoliDB
* @param int $arg_count Arg count * @param int $arg_count Arg count
* @return void * @return void
*/ */
private function addCustomFunction($name, $arg_count = -1) { private function addCustomFunction($name, $arg_count = -1)
if ($this->db) { {
$localname = __CLASS__ . '::' . 'db' . $name; if ($this->db)
{
$newname=preg_replace('/_/','',$name);
$localname = __CLASS__ . '::' . 'db' . $newname;
$reflectClass = new ReflectionClass(__CLASS__); $reflectClass = new ReflectionClass(__CLASS__);
$reflectFunction = $reflectClass->getMethod('db' . $name); $reflectFunction = $reflectClass->getMethod('db' . $newname);
if ($arg_count < 0) { if ($arg_count < 0) {
$arg_count = $reflectFunction->getNumberOfParameters(); $arg_count = $reflectFunction->getNumberOfParameters();
} }
@ -1274,7 +1277,7 @@ class DoliDBSqlite3 extends DoliDB
* Cette fonction est l'equivalent de la fonction MONTH de MySql. * Cette fonction est l'equivalent de la fonction MONTH de MySql.
* *
* @param string $date Date * @param string $date Date
* @return integer * @return string
*/ */
public static function dbMONTH($date) public static function dbMONTH($date)
{ {
@ -1317,7 +1320,7 @@ class DoliDBSqlite3 extends DoliDB
* dbWEEKDAY * dbWEEKDAY
* *
* @param int $date Date * @param int $date Date
* @return string * @return double
*/ */
public static function dbWEEKDAY($date) { public static function dbWEEKDAY($date) {
$arr = date_parse($date); $arr = date_parse($date);
@ -1333,7 +1336,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $format la chaine de formatage * @param string $format la chaine de formatage
* @return string La date formatee. * @return string La date formatee.
*/ */
public static function dbdate_format($date, $format) public static function dbdateformat($date, $format)
{ {
static $mysql_replacement; static $mysql_replacement;
if (! isset($mysql_replacement)) { if (! isset($mysql_replacement)) {
@ -1469,7 +1472,7 @@ class DoliDBSqlite3 extends DoliDB
* week_mode * week_mode
* *
* @param string $mode Mode * @param string $mode Mode
* @return string Week format * @return integer Week format
*/ */
private static function week_mode($mode) { private static function week_mode($mode) {
$week_format= ($mode & 7); $week_format= ($mode & 7);

View File

@ -84,7 +84,7 @@ function CreateXmlFooter()
/** /**
* SendError * SendError
* *
* @param unknown_type $number Number * @param integer $number Number
* @param unknown_type $text Text * @param unknown_type $text Text
* @return void * @return void
*/ */

View File

@ -30,7 +30,7 @@ require 'commands.php';
/** /**
* SendError * SendError
* *
* @param string $number Number * @param integer $number Number
* @param string $text Text * @param string $text Text
* @return void * @return void
*/ */

View File

@ -122,7 +122,28 @@ function updateTotal(days,mode)
var nbline = document.getElementById('numberOfLines').value; var nbline = document.getElementById('numberOfLines').value;
for (var i=0;i<nbline;i++) for (var i=0;i<nbline;i++)
{ {
var id='task['+i+']['+days+']'; var id='timespent['+i+']['+days+']';
var taskTime= new Date(0);
var element=document.getElementById(id);
if(element)
{
/* alert(element.value);*/
if (element.value)
{
result=parseTime(element.value,taskTime);
}
else
{
result=parseTime(element.innerHTML,taskTime);
}
if (result >= 0)
{
total.setHours(total.getHours()+taskTime.getHours());
total.setMinutes(total.getMinutes()+taskTime.getMinutes());
}
}
var id='timeadded['+i+']['+days+']';
var taskTime= new Date(0); var taskTime= new Date(0);
var element=document.getElementById(id); var element=document.getElementById(id);
if(element) if(element)
@ -152,7 +173,23 @@ function updateTotal(days,mode)
var nbline = document.getElementById('numberOfLines').value; var nbline = document.getElementById('numberOfLines').value;
for (var i=0;i<nbline;i++) for (var i=0;i<nbline;i++)
{ {
var id='task['+i+']['+days+']'; var id='timespent['+i+']['+days+']';
var taskTime= new Date(0);
var element=document.getElementById(id);
if(element)
{
if (element.value)
{
total+=parseInt(element.value);
}
else
{
total+=parseInt(element.innerHTML);
}
}
var id='timeadded['+i+']['+days+']';
var taskTime= new Date(0); var taskTime= new Date(0);
var element=document.getElementById(id); var element=document.getElementById(id);
if(element) if(element)

View File

@ -386,6 +386,12 @@ function dolibarr_del_const($db, $name, $entity=1)
{ {
global $conf; global $conf;
if (empty($name))
{
dol_print_error('','Error call dolibar_del_const with parameter name empty');
return -1;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'"; $sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'";
if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'"; if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'";
@ -438,7 +444,7 @@ function dolibarr_get_const($db, $name, $entity=1)
/** /**
* Insert a parameter (key,value) into database. * Insert a parameter (key,value) into database (delete old key then insert it again).
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $name Name of constant * @param string $name Name of constant

View File

@ -120,7 +120,7 @@ function bank_admin_prepare_head($object)
* Check SWIFT informations for a bank account * Check SWIFT informations for a bank account
* *
* @param Account $account A bank account * @param Account $account A bank account
* @return int True if informations are valid, false otherwise * @return boolean True if informations are valid, false otherwise
*/ */
function checkSwiftForAccount($account) function checkSwiftForAccount($account)
{ {
@ -137,7 +137,7 @@ function checkSwiftForAccount($account)
* Check IBAN number informations for a bank account * Check IBAN number informations for a bank account
* *
* @param Account $account A bank account * @param Account $account A bank account
* @return int True if informations are valid, false otherwise * @return boolean True if informations are valid, false otherwise
*/ */
function checkIbanForAccount($account) function checkIbanForAccount($account)
{ {
@ -156,7 +156,7 @@ function checkIbanForAccount($account)
* Check account number informations for a bank account * Check account number informations for a bank account
* *
* @param Account $account A bank account * @param Account $account A bank account
* @return int True if informations are valid, false otherwise * @return boolean True if informations are valid, false otherwise
*/ */
function checkBanForAccount($account) function checkBanForAccount($account)
{ {

View File

@ -95,6 +95,7 @@ function getServerTimeZoneInt($refgmtdate='now')
} }
else else
{ {
$tmp=0;
dol_print_error('','PHP version must be 5.3+'); dol_print_error('','PHP version must be 5.3+');
/* /*
// Method 2 (does not include daylight, not supported by adodb) // Method 2 (does not include daylight, not supported by adodb)

View File

@ -592,16 +592,17 @@ function dol_strtoupper($utf8_string)
* This function works only if syslog module is enabled. * This function works only if syslog module is enabled.
* This must not use any call to other function calling dol_syslog (avoid infinite loop). * This must not use any call to other function calling dol_syslog (avoid infinite loop).
* *
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR * @param string $message Line to log.
* @param int $level Log level * @param int $level Log level
* 0=Show nothing * 0=Show nothing
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr * On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7 * On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1 * @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @param string $suffixinfilename When output is a file, append this suffix into default log filename. * @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @param string $restricttologhandler Output log only for this log handler
* @return void * @return void
*/ */
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='') function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='', $restricttologhandler='')
{ {
global $conf, $user; global $conf, $user;
@ -624,7 +625,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message; $conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
} }
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a HTML handler //TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a log handler dedicated to HTML output
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments // If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"])) if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
{ {
@ -648,10 +649,10 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']); else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']);
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME']; else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME'];
// Loop on each log handler and send output // Loop on each log handler and send output
foreach ($conf->loghandlers as $loghandlerinstance) foreach ($conf->loghandlers as $loghandlerinstance)
{ {
if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) continue;
$loghandlerinstance->export($data,$suffixinfilename); $loghandlerinstance->export($data,$suffixinfilename);
} }
unset($data); unset($data);
@ -1633,14 +1634,14 @@ function dol_print_address($address, $htmlid, $mode, $id)
/** /**
* Return true if email syntax is ok * Return true if email syntax is ok
* *
* @param string $address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>") * @param string $address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
* @return boolean true if email syntax is OK, false if KO or empty string * @param int $acceptsupervisorkey If 1, the special string '__SUPERVISOREMAIL__' is also accepted as valid
* @return boolean true if email syntax is OK, false if KO or empty string
*/ */
function isValidEmail($address) function isValidEmail($address, $acceptsupervisorkey=0)
{ {
if (filter_var($address, FILTER_VALIDATE_EMAIL)) { if ($acceptsupervisorkey && $address == '__SUPERVISOREMAIL__') return true;
return true; if (filter_var($address, FILTER_VALIDATE_EMAIL)) return true;
}
return false; return false;
} }
@ -2116,7 +2117,7 @@ function img_edit_remove($titlealt = 'default', $other='')
* Show logo editer/modifier fiche * Show logo editer/modifier fiche
* *
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param float $float Si il faut y mettre le style "float: right" * @param integer $float Si il faut y mettre le style "float: right"
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Return tag img * @return string Return tag img
*/ */
@ -2133,7 +2134,7 @@ function img_edit($titlealt = 'default', $float = 0, $other = '')
* Show logo view card * Show logo view card
* *
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param float $float Si il faut y mettre le style "float: right" * @param integer $float Si il faut y mettre le style "float: right"
* @param string $other Add more attributes on img * @param string $other Add more attributes on img
* @return string Return tag img * @return string Return tag img
*/ */
@ -2446,7 +2447,7 @@ function img_searchclear($titlealt = 'default', $other = '')
* Show information for admin users * Show information for admin users
* *
* @param string $text Text info * @param string $text Text info
* @param string $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto * @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* @param int $nodiv No div * @param int $nodiv No div
* @return string String with info text * @return string String with info text
*/ */
@ -2495,7 +2496,7 @@ function dol_print_error($db='',$error='')
if ($_SERVER['DOCUMENT_ROOT']) // Mode web if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{ {
$out.=$langs->trans("DolibarrHasDetectedError").".<br>\n"; $out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $out.="You use an experimental level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n"; if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $out.="You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n";
$out.=$langs->trans("InformationToHelpDiagnose").":<br>\n"; $out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
$out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n"; $out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";
@ -2866,7 +2867,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
* @param int $page Number of page * @param int $page Number of page
* @param string $file Lien * @param string $file Lien
* @param string $options Autres parametres d'url a propager dans les liens ("" par defaut) * @param string $options Autres parametres d'url a propager dans les liens ("" par defaut)
* @param boolean|int $nextpage Do we show a next page button * @param integer $nextpage Do we show a next page button
* @param string $betweenarrows HTML Content to show between arrows * @param string $betweenarrows HTML Content to show between arrows
* @return void * @return void
*/ */
@ -2923,7 +2924,7 @@ function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
* Function used into PDF and HTML pages * Function used into PDF and HTML pages
* *
* @param float $amount Amount to format * @param float $amount Amount to format
* @param string $form Type of format, HTML or not (not by default) * @param integer $form Type of format, HTML or not (not by default)
* @param Translate $outlangs Object langs for output * @param Translate $outlangs Object langs for output
* @param int $trunc 1=Truncate if there is too much decimals (default), 0=Does not truncate * @param int $trunc 1=Truncate if there is too much decimals (default), 0=Does not truncate
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL) * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
@ -3622,7 +3623,7 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
* @param Societe $thirdparty_buyer Thirdparty buyer * @param Societe $thirdparty_buyer Thirdparty buyer
* @param int $local Localtax to process (1 or 2) * @param int $local Localtax to process (1 or 2)
* @param int $idprod Id product * @param int $idprod Id product
* @return float localtax, -1 si ne peut etre determine * @return integer localtax, -1 si ne peut etre determine
* @see get_default_tva, get_default_npr * @see get_default_tva, get_default_npr
*/ */
function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0) function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0)
@ -3664,7 +3665,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id
* Return yes or no in current language * Return yes or no in current language
* *
* @param string $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false') * @param string $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false')
* @param string $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No * @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Yes/No
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color. * @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
* @return string HTML string * @return string HTML string
*/ */
@ -3805,7 +3806,7 @@ function picto_required()
* Clean a string from all HTML tags and entities * Clean a string from all HTML tags and entities
* *
* @param string $StringHtml String to clean * @param string $StringHtml String to clean
* @param string $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed * @param integer $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed
* @param string $pagecodeto Encoding of input/output string * @param string $pagecodeto Encoding of input/output string
* @return string String cleaned * @return string String cleaned
* *
@ -4183,7 +4184,7 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
* @param int $date_end End date * @param int $date_end End date
* @param string $format Output format * @param string $format Output format
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @param string $withparenthesis 1=Add parenthesis, 0=non parenthesis * @param integer $withparenthesis 1=Add parenthesis, 0=non parenthesis
* @return string String * @return string String
*/ */
function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $withparenthesis=1) function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $withparenthesis=1)
@ -4542,7 +4543,7 @@ function utf8_check($str)
/** /**
* Return an UTF-8 string encoded into OS filesystem encoding. This function is used to define * Return a string encoded into OS filesystem encoding. This function is used to define
* value to pass to filesystem PHP functions. * value to pass to filesystem PHP functions.
* *
* @param string $str String to encode (UTF-8) * @param string $str String to encode (UTF-8)
@ -4845,7 +4846,7 @@ function printCommonFooter($zone='private')
print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off'); print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED)?$conf->global->MAIN_OPTIMIZE_SPEED:'off');
if ($micro_start_time) if ($micro_start_time)
{ {
$micro_end_time=dol_microtime_float(true); $micro_end_time=dol_microtime_float();
print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms'; print ' - Build time: '.ceil(1000*($micro_end_time-$micro_start_time)).' ms';
} }
if (function_exists("memory_get_usage")) if (function_exists("memory_get_usage"))
@ -4952,7 +4953,7 @@ function dol_getmypid()
* @param string $value The value to look for. * @param string $value The value to look for.
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2 * If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000" * If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000"
* @param string $numeric 0=value is list of keywords, 1=value is a numeric test * @param integer $numeric 0=value is list of keywords, 1=value is a numeric test
* @return string $res The statement to append to the SQL query * @return string $res The statement to append to the SQL query
*/ */
function natural_search($fields, $value, $numeric=0) function natural_search($fields, $value, $numeric=0)

View File

@ -941,7 +941,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
* @param int $hideref Hide reference * @param int $hideref Hide reference
* @param int $hidedesc Hide description * @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ? * @param int $issupplierline Is it a line for a supplier object ?
* @return void * @return string|null
*/ */
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0) function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
{ {
@ -1159,7 +1159,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
* @param int $i Current line number * @param int $i Current line number
* @param Translate $outputlangs Object langs for output * @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void * @return null|string
*/ */
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0) function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
{ {
@ -1185,7 +1185,7 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number * @param int $i Current line number
* @param Translate $outputlangs Object langs for output * @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void * @return null|string
*/ */
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0) function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
{ {
@ -1210,7 +1210,7 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number * @param int $i Current line number
* @param Translate $outputlangs Object langs for output * @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void * @return null|string
*/ */
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0) function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
{ {
@ -1569,7 +1569,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
* @param Object $object Object * @param Object $object Object
* @param string $type Type * @param string $type Type
* @param Translate $outputlangs Object langs for output * @param Translate $outputlangs Object langs for output
* @return void * @return integer
*/ */
function pdf_getTotalQty($object,$type,$outputlangs) function pdf_getTotalQty($object,$type,$outputlangs)
{ {

View File

@ -49,7 +49,7 @@
* @param int $type 0/1=Product/service * @param int $type 0/1=Product/service
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. * @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function). * @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function).
* @param float $progress Situation invoices progress (value from 0 to 100, 100 by default) * @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @return result[ 0=total_ht, * @return result[ 0=total_ht,
* 1=total_vat, * 1=total_vat,
* 2=total_ttc, * 2=total_ttc,

View File

@ -27,7 +27,7 @@
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
* @param Object $object Object related to tabs * @param Product $object Object related to tabs
* @param User $user Object user * @param User $user Object user
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
@ -183,7 +183,7 @@ function product_admin_prepare_head()
* *
* @param Product $product Product object * @param Product $product Product object
* @param int $socid Thirdparty id * @param int $socid Thirdparty id
* @return void * @return integer
*/ */
function show_stats_for_company($product,$socid) function show_stats_for_company($product,$socid)
{ {

View File

@ -177,7 +177,15 @@ function project_timesheet_prepare_head($mode)
$h = 0; $h = 0;
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERDAY)) if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
{
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perweek.php".($mode?'?mode='.$mode:'');
$head[$h][1] = $langs->trans("InputPerWeek");
$head[$h][2] = 'inputperweek';
$h++;
}
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
{ {
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:''); $head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:'');
$head[$h][1] = $langs->trans("InputPerDay"); $head[$h][1] = $langs->trans("InputPerDay");
@ -185,13 +193,13 @@ function project_timesheet_prepare_head($mode)
$h++; $h++;
} }
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) /*if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERACTION))
{ {
$head[$h][0] = DOL_URL_ROOT."/projet/activity/pertime.php".($mode?'?mode='.$mode:''); $head[$h][0] = DOL_URL_ROOT."/projet/activity/peraction.php".($mode?'?mode='.$mode:'');
$head[$h][1] = $langs->trans("InputPerTime"); $head[$h][1] = $langs->trans("InputPerAction");
$head[$h][2] = 'inputpertime'; $head[$h][2] = 'inputperaction';
$h++; $h++;
} }*/
complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet'); complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet');
@ -498,17 +506,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
*/ */
function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
{ {
global $db, $user, $bc, $langs; global $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic; global $form, $formother, $projectstatic, $taskstatic;
if (! is_object($formother))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
}
$lastprojectid=0; $lastprojectid=0;
$var=true; $var=true;
@ -617,7 +619,7 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
print '</td><td align="right">'; print '</td><td align="right">';
//$s.='&nbsp;&nbsp;&nbsp;'; //$s.='&nbsp;&nbsp;&nbsp;';
$s=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); $s=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1);
$s.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">'; //$s.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
print $s; print $s;
print '</td>'; print '</td>';
@ -631,7 +633,7 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
$inc++; $inc++;
$level++; $level++;
if ($lines[$i]->id) projectLinesPerTime($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
$level--; $level--;
} }
else else
@ -649,6 +651,8 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
* Output a task line into a perday intput mode * Output a task line into a perday intput mode
* *
* @param string $inc Line number (start to 0, then increased by recursive call) * @param string $inc Line number (start to 0, then increased by recursive call)
* @param int $firstdaytoshow First day to show
* @param User|null $fuser Restrict list to user if defined
* @param string $parent Id of parent project to show (0 to show all) * @param string $parent Id of parent project to show (0 to show all)
* @param Task[] $lines Array of lines * @param Task[] $lines Array of lines
* @param int $level Level (start to 0, then increased/decrease by recursive call) * @param int $level Level (start to 0, then increased/decrease by recursive call)
@ -658,17 +662,11 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
*/ */
function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
{ {
global $db, $user, $bc, $langs; global $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic; global $form, $formother, $projectstatic, $taskstatic;
if (! is_object($formother))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
}
$lastprojectid=0; $lastprojectid=0;
$var=true; $var=true;
@ -687,7 +685,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
$lastprojectid=$lines[$i]->fk_project; $lastprojectid=$lines[$i]->fk_project;
$projectstatic->id = $lines[$i]->fk_project; $projectstatic->id = $lines[$i]->fk_project;
$projectstatic->loadTimeSpent($datestart, $lines[$i]->id, $fuser->id); $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week
} }
// If we want all or we have a role on task, we show it // If we want all or we have a role on task, we show it
@ -708,17 +706,18 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
print '<td class="nowrap">'; print '<td class="nowrap">';
$taskstatic->id=$lines[$i]->id; $taskstatic->id=$lines[$i]->id;
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
print $taskstatic->getNomUrl(1); print $taskstatic->getNomUrl(1, 'withproject', 'time');
print '</td>'; print '</td>';
// Label task // Label task
print "<td>"; print "<td>";
print '<!-- Task id = '.$lines[$i]->id.' -->';
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;"; for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
$taskstatic->id=$lines[$i]->id; $taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->label; $taskstatic->ref=$lines[$i]->label;
$taskstatic->date_start=$lines[$i]->date_start; $taskstatic->date_start=$lines[$i]->date_start;
$taskstatic->date_end=$lines[$i]->date_end; $taskstatic->date_end=$lines[$i]->date_end;
print $taskstatic->getNomUrl(0); print $taskstatic->getNomUrl(0, 'withproject', 'time');
//print "<br>"; //print "<br>";
//for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;"; //for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
@ -770,18 +769,22 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
$disabledtask=1; $disabledtask=1;
} }
//var_dump($projectstatic->weekWorkLoad); //var_dump($projectstatic->weekWorkLoadPerTask);
// Fields to show current time // Fields to show current time
$tableCell=''; $modeinput='hours'; $tableCell=''; $modeinput='hours';
for ($idw = 0; $idw < 7; $idw++) for ($idw = 0; $idw < 7; $idw++)
{ {
$dayWorkLoad = 0; $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
$dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
$alreadyspent='';
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
$tableCell ='<td align="center">'; $tableCell ='<td align="center">';
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'"></span>+'; $tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled="disabled" id="timespent['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="'.$alreadyspent.'"></span>';
$tableCell.='<input type="text" class="center" size="2" id="task['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"'; $tableCell.='+';
$tableCell.='<input type="text" class="center" size="2" id="timeadded['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"'; $tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
$tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\');updateTotal('.$idw.',\''.$modeinput.'\')" />'; $tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\'); updateTotal('.$idw.',\''.$modeinput.'\')" />';
$tableCell.='</td>'; $tableCell.='</td>';
print $tableCell; print $tableCell;
} }
@ -790,7 +793,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
$inc++; $inc++;
$level++; $level++;
if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); if ($lines[$i]->id) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
$level--; $level--;
} }
else else

View File

@ -31,7 +31,7 @@
* @param array $fulltree Array of entries in correct order * @param array $fulltree Array of entries in correct order
* @param string $key Key of entry into fulltree to show picto * @param string $key Key of entry into fulltree to show picto
* @param int $silent Do not output indent and picto, returns only value * @param int $silent Do not output indent and picto, returns only value
* @return array array(0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after, nbofdirinsub, nbofdocinsub) * @return integer[] array(0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after, nbofdirinsub, nbofdocinsub)
*/ */
function tree_showpad(&$fulltree,$key,$silent=0) function tree_showpad(&$fulltree,$key,$silent=0)
{ {

View File

@ -248,12 +248,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perday.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&amp;mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&amp;mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create&amp;mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create&amp;mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&amp;mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&amp;mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perday.php?leftmenu=projects&amp;mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects&amp;mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
-- Tools -- Tools
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);

View File

@ -158,7 +158,7 @@ class MenuManager
* Show menu * Show menu
* *
* @param string $mode 'top', 'left', 'jmobile' * @param string $mode 'top', 'left', 'jmobile'
* @return void * @return string
*/ */
function showmenu($mode) function showmenu($mode)
{ {

View File

@ -1158,13 +1158,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/activity/perday.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); $newmenu->add("/projet/activity/perweek.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
// All project i have permission on // All project i have permission on
$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
$newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/activity/perday.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/activity/perweek.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
} }
} }
} }

View File

@ -112,7 +112,7 @@ class MenuManager
* Show menu * Show menu
* *
* @param string $mode 'top', 'left', 'jmobile' * @param string $mode 'top', 'left', 'jmobile'
* @return void * @return string
*/ */
function showmenu($mode) function showmenu($mode)
{ {

View File

@ -61,7 +61,7 @@ class MenuManager
* Show menu * Show menu
* *
* @param string $mode 'top', 'left', 'jmobile' * @param string $mode 'top', 'left', 'jmobile'
* @return void * @return string
*/ */
function showmenu($mode) function showmenu($mode)
{ {

View File

@ -303,7 +303,7 @@ class CommActionRapport
* @param PDF $pdf Object PDF * @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output
* @param int $pagenb Page nb * @param int $pagenb Page nb
* @return void * @return integer
*/ */
function _pagehead(&$pdf, $outputlangs, $pagenb) function _pagehead(&$pdf, $outputlangs, $pagenb)
{ {

View File

@ -108,7 +108,7 @@ class modPhpbarcode extends ModeleBarCode
* @param string $code Value to encode * @param string $code Value to encode
* @param string $encoding Mode of encoding * @param string $encoding Mode of encoding
* @param string $readable Code can be read * @param string $readable Code can be read
* @param string $scale Scale * @param integer $scale Scale
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function buildBarCode($code,$encoding,$readable='Y',$scale=1) function buildBarCode($code,$encoding,$readable='Y',$scale=1)
@ -148,7 +148,7 @@ class modPhpbarcode extends ModeleBarCode
* @param string $code Value to encode * @param string $code Value to encode
* @param string $encoding Mode of encoding * @param string $encoding Mode of encoding
* @param string $readable Code can be read * @param string $readable Code can be read
* @param string $scale Scale * @param integer $scale Scale
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function writeBarCode($code,$encoding,$readable='Y',$scale=1) function writeBarCode($code,$encoding,$readable='Y',$scale=1)

View File

@ -42,7 +42,7 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
* Return list of active generation modules * Return list of active generation modules
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array List of templates * @return array List of templates
*/ */
static function liste_modeles($db,$maxfilenamelength=0) static function liste_modeles($db,$maxfilenamelength=0)

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