+
trans("SellFinished"); ?>
';
}
- print '';
+ print '';
}
if ($page > 0)
{
@@ -3393,7 +3393,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
{
$morelabel='';
-
+
if (preg_match('/%/',$rate))
{
$rate=str_replace('%','',$rate);
@@ -3596,7 +3596,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
/**
* Output a dimension with best unit
- *
+ *
* @param float $dimension Dimension
* @param int $unit Unit of dimension (0, -3, ...)
* @param string $type 'weight', 'volume', ...
@@ -3608,16 +3608,16 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
-
- if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
+
+ if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
{
$dimension = $dimension * 1000000;
- $unit = $unit - 6;
+ $unit = $unit - 6;
}
elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3))
{
$dimension = $dimension * 1000;
- $unit = $unit - 3;
+ $unit = $unit - 3;
}
elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6))
{
@@ -3629,9 +3629,9 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
$dimension = $dimension / 1000;
$unit = $unit + 3;
}
-
+
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
-
+
return $ret;
}
@@ -3662,12 +3662,12 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2];
}
-
+
/*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code)
{
return 0;
}*/
-
+
// Some test to guess with no need to make database access
if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
{
@@ -3765,7 +3765,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local==1) return $obj->localtax1;
elseif ($local==2) return $obj->localtax2;
}
-
+
return 0;
}
@@ -3825,7 +3825,7 @@ function get_localtax_by_third($local)
/**
* Get vat rate and npr from id.
- * You can call getLocalTaxesFromRate after to get other fields
+ * You can call getLocalTaxesFromRate after to get other fields
*
* @param int $vatrowid Line ID into vat rate table.
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
@@ -3879,7 +3879,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$vatratecleaned = $reg[1];
$vatratecode = $reg[2];
}
-
+
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
@@ -3892,7 +3892,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
}
-
+
$resql=$db->query($sql);
if ($resql)
{
@@ -4299,7 +4299,7 @@ function yn($yesno, $case=1, $color=0)
/**
* Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
- * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
+ * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
*
* @param string $num Id of object (deprecated, $object will be used in future)
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
@@ -4316,7 +4316,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
$path = '';
$arrayforoldpath=array('cheque','user','category','holiday','shipment','supplier_invoice','invoice_supplier','mailing');
- if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
+ if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
@@ -4469,7 +4469,7 @@ function dolGetFirstLineOfText($text)
{
$firstline=preg_replace('/
]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
$firstline=preg_replace('/
]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
-
+
}
else
{
@@ -5375,7 +5375,7 @@ function picto_from_langcode($codelang)
}
/**
- * Complete or removed entries into a head array (used to build tabs).
+ * Complete or removed entries into a head array (used to build tabs).
* For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab'].
* Or by change using hook completeTabsHead
*
@@ -5405,7 +5405,7 @@ function picto_from_langcode($codelang)
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
{
global $hookmanager;
-
+
if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type]))
{
foreach ($conf->modules_parts['tabs'][$type] as $value)
@@ -5471,7 +5471,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
}
}
}
-
+
// No need to make a return $head. Var is modified as a reference
if (! empty($hookmanager))
{
@@ -5509,11 +5509,11 @@ function printCommonFooter($zone='private')
{
print ''."\n";
print ''."\n";
}
-
+
// Google Analytics (need Google module)
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
{
@@ -5749,15 +5749,15 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
$tmpcrit=trim($tmpcrit);
$tmpcrit2=$tmpcrit;
$tmpbefore='%'; $tmpafter='%';
- if (preg_match('/^[\^\$]/', $tmpcrit))
- {
+ if (preg_match('/^[\^\$]/', $tmpcrit))
+ {
$tmpbefore='';
- $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
+ $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
}
- if (preg_match('/[\^\$]$/', $tmpcrit))
- {
+ if (preg_match('/[\^\$]$/', $tmpcrit))
+ {
$tmpafter='';
- $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
+ $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
}
$newres .= $tmpbefore;
$newres .= $db->escape($tmpcrit2);
@@ -5822,7 +5822,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
function getAdvancedPreviewUrl($modulepart, $relativepath)
{
global $conf;
-
+
if (empty($conf->use_javascript_ajax)) return '';
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');
diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php
index 9cf745a0da0..00153a7849d 100644
--- a/htdocs/core/lib/images.lib.php
+++ b/htdocs/core/lib/images.lib.php
@@ -37,8 +37,10 @@ $quality = 80;
*/
function image_format_supported($file)
{
+ $regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm'; // See also into product.class.php
+
// Case filename is not a format image
- if (! preg_match('/(\.gif|\.jpg|\.jpeg|\.png|\.bmp)$/i',$file,$reg)) return -1;
+ if (! preg_match('/('.$regeximgext.')$/i',$file,$reg)) return -1;
// Case filename is a format image but not supported by this PHP
$imgfonction='';
@@ -47,6 +49,8 @@ function image_format_supported($file)
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
+ if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
+ if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
if ($imgfonction)
{
if (! function_exists($imgfonction))
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index a88e180b16a..8c6c7311f82 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -111,13 +111,13 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$chaine="";
if (! empty($conf->product->enabled)) {
- $chaine.=$langs->trans("Products");
+ $chaine.=$langs->trans("TMenuProducts");
}
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) {
- $chaine.="/";
+ $chaine.=" | ";
}
if (! empty($conf->service->enabled)) {
- $chaine.=$langs->trans("Services");
+ $chaine.=$langs->trans("TMenuServices");
}
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
@@ -261,7 +261,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$idsel='tools';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
- if (empty($noout)) print_text_menu_entry($langs->trans("Tools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&leftmenu=', $id, $idsel, $classname, $atarget);
+ if (empty($noout)) print_text_menu_entry($langs->trans("TMenuTools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '');
}
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index a0c2a6e9de4..2ba37ad3cbd 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -189,7 +189,7 @@ class modAgenda extends DolibarrModules
// $r++;
$this->menu[$r]=array('fk_menu'=>0,
'type'=>'top',
- 'titre'=>'Agenda',
+ 'titre'=>'TMenuAgenda',
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php',
'langs'=>'agenda',
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 778c37f686a..8fcd0d2b930 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -134,11 +134,50 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
{
$fullpath=$dir."/".$original_file;
$result=dol_imageResizeOrCrop($fullpath,0,$_POST['sizex'],$_POST['sizey']);
-
+
if ($result == $fullpath)
{
$object->addThumbs($fullpath);
+ // Update/create database for file $fullpath
+ $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $fullpath);
+ $rel_filename = preg_replace('/^[\\/]/','',$rel_filename);
+
+ include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
+ $ecmfile=new EcmFiles($db);
+ $result = $ecmfile->fetch(0, '', $rel_filename);
+ if ($result > 0) // If found
+ {
+ $filename = basename($rel_filename);
+ $rel_dir = dirname($rel_filename);
+ $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
+ $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
+
+ $ecmfile->label = md5_file(dol_osencode($fullpath));
+ $result = $ecmfile->update($user);
+ }
+ elseif ($result == 0) // If not found
+ {
+ $filename = basename($rel_filename);
+ $rel_dir = dirname($rel_filename);
+ $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
+ $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
+
+ $ecmfile->filepath = $rel_dir;
+ $ecmfile->filename = $filename;
+ $ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
+ $ecmfile->fullpath_orig = $fullpath;
+ $ecmfile->gen_or_uploaded = 'unknown';
+ $ecmfile->description = ''; // indexed content
+ $ecmfile->keyword = ''; // keyword content
+ $result = $ecmfile->create($user);
+ if ($result < 0)
+ {
+ setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
+ }
+ $result = $ecmfile->create($user);
+ }
+
if ($backtourl)
{
header("Location: ".$backtourl);
@@ -168,6 +207,45 @@ if ($action == 'confirm_crop')
{
$object->addThumbs($fullpath);
+ // Update/create database for file $fullpath
+ $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $fullpath);
+ $rel_filename = preg_replace('/^[\\/]/','',$rel_filename);
+
+ include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
+ $ecmfile=new EcmFiles($db);
+ $result = $ecmfile->fetch(0, '', $rel_filename);
+ if ($result > 0) // If found
+ {
+ $filename = basename($rel_filename);
+ $rel_dir = dirname($rel_filename);
+ $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
+ $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
+
+ $ecmfile->label = md5_file(dol_osencode($fullpath));
+ $result = $ecmfile->update($user);
+ }
+ elseif ($result == 0) // If not found
+ {
+ $filename = basename($rel_filename);
+ $rel_dir = dirname($rel_filename);
+ $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
+ $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
+
+ $ecmfile->filepath = $rel_dir;
+ $ecmfile->filename = $filename;
+ $ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
+ $ecmfile->fullpath_orig = $fullpath;
+ $ecmfile->gen_or_uploaded = 'unknown';
+ $ecmfile->description = ''; // indexed content
+ $ecmfile->keyword = ''; // keyword content
+ $result = $ecmfile->create($user);
+ if ($result < 0)
+ {
+ setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
+ }
+ $result = $ecmfile->create($user);
+ }
+
if ($backtourl)
{
header("Location: ".$backtourl);
@@ -218,10 +296,11 @@ print '';
print $langs->trans("ResizeDesc").'
';
print $langs->trans("NewLength").': px '.$langs->trans("or").' ';
print $langs->trans("NewHeight").': px
';
+
print '';
print '';
print '';
-print '';
+print '';
print '';
print '
';
print '';
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
index 123fcef662c..d0a7b45efea 100644
--- a/htdocs/core/tpl/ajaxrow.tpl.php
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -17,18 +17,19 @@
*
* Javascript code to activate drag and drop on lines
* You can use this if you want to be abale to drag and drop rows of a table.
- * You must add id="tablelines" on table level tag and have count($object->lines) or count($taskarray) > 0
+ * You must add id="tablelines" on table level tag and have ($nboflines or count($object->lines) or count($taskarray) > 0)
*/
?>
-
+
id;
$fk_element=$object->fk_element;
-$table_element_line=$object->table_element_line;
-$nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):0));
+$table_element_line=(empty($table_element_line)?$object->table_element_line:$table_element_line);
+$nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):(empty($nboflines)?0:$nboflines)));
$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
+$filepath=(empty($filepath)?'':$filepath);
if (GETPOST('action') != 'editline' && $nboflines > 1) { ?>